{"id":22278665,"url":"https://github.com/rsm-hcd/docker-dotnet-example","last_synced_at":"2025-07-28T18:30:50.756Z","repository":{"id":86692132,"uuid":"110595890","full_name":"rsm-hcd/docker-dotnet-example","owner":"rsm-hcd","description":"Demonstrates configuration of Docker and .NET Core for a development workflow","archived":false,"fork":false,"pushed_at":"2018-01-19T13:43:59.000Z","size":94,"stargazers_count":8,"open_issues_count":1,"forks_count":6,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-21T08:13:59.182Z","etag":null,"topics":["docker","dotnet-core"],"latest_commit_sha":null,"homepage":"http://andculture.com","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rsm-hcd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-11-13T20:04:58.000Z","updated_at":"2022-06-05T12:43:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"d3e85c42-6b7d-473f-abf2-f93e5ab4db25","html_url":"https://github.com/rsm-hcd/docker-dotnet-example","commit_stats":null,"previous_names":["rsm-hcd/docker-dotnet-example","andculturecode/docker-dotnet-example"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rsm-hcd/docker-dotnet-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rsm-hcd%2Fdocker-dotnet-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rsm-hcd%2Fdocker-dotnet-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rsm-hcd%2Fdocker-dotnet-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rsm-hcd%2Fdocker-dotnet-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rsm-hcd","download_url":"https://codeload.github.com/rsm-hcd/docker-dotnet-example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rsm-hcd%2Fdocker-dotnet-example/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267563490,"owners_count":24108097,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","dotnet-core"],"created_at":"2024-12-03T15:15:24.156Z","updated_at":"2025-07-28T18:30:50.338Z","avatar_url":"https://github.com/rsm-hcd.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Docker \u0026 .NET Core Example\n\n## Architecture Overview\nThe project is built leveraging the following technologies:\n\n* Docker\n* ASP.NET Core 2.0\n* Microsoft SQL Server (Linux)\n* React\n* Webpack\n\nThe .NET web project includes two primary directories, `Client` and `Server`. The `Client` directory includes the React application as well as general assets like SCSS files and static images. The `Server` directory includes the backend code for API Controllers and any MVC View architecture utilizing Razor syntax.\n\nThe back-end project is using the [Onion Architecture](http://jeffreypalermo.com/blog/the-onion-architecture-part-1/) approach in .NET. There are `Business`, `Infrastructure` and `Presentation` projects in the solution. All business logic, models and reusable code lives within the `Business` portion of the application. All concrete data access resides in the `Infrastructure` portion of the application. Finally, all presentation projects or projects that contain views for the user reside in the `Presentation` portion of the application.\n\nThe rule of onion architecture says that the core of the onion should be created in a way where it knows nothing about the other layers. `Infrastructure` can utilize the `Business`, but `Business` should not utilize `Infrastructure`.\n\n## Noteworthy\n\n* Docker Sync\n    * This tool is installed on Mac OSX clients to improve the performance of File IO when mounting a host Mac OSX project in a linux container.\n    * Unfortunately the windows support is too complex to be useable (imho).\n    * Hopefully this isn't necessary in the future as Microsoft and Docker invest in the development workflow story between the two technologies.\n\n* Environment variables strategy\n    * The SDK, Docker and .NET Core all leverage the `.env` file (one configuration to rule them all)\n    * .NET Core `appsettings.json` should only contain static settings. As soon as something becomes configurable, bubble it up the `.env` and the respective `.env.{environment}.sample` file.\n\n* Logging\n    * .NET Core `Program.cs` demonstrates using SeriLog in .NET Core v2. Allowing for dependency injection of `ILogger\u003cT\u003e` in `Startup.cs`\n\n* Windows Development\n    * Unfortunately at this time, the windows development environment is too slow for me to advocate for its use. For windows users, simply set `STARTUP_SERVICES` to `database` so you can leverage that part of the infrastructure while running `./sdk run-web` to build the dotnet and webpack asset files locally.\n\n\n## System setup\n\nStart by cloning the repository using `git clone REPO`\n* From a bash window (terminal or command prompt), change the directory to the newly created repository\n\nNow follow instructions for your operating system...\n\n#### Mac\n* Install \u0026 Run [Docker](https://download.docker.com/mac/stable/Docker.dmg)\n    * Make sure to allocate at least 4 GB of RAM to docker. Otherwise MSSQL won't work.\n* Increase SDK CLI permissions\n    * With your terminal/shell of choice, run `sudo chmod +x sdk` in the root of this repository\n    * Follow that up with `./sdk` to verify that it worked. If all is well, you'll see current usage information about the CLI.\n* From the bash window, execute the following `./sdk run`\n* After running that script, you may not want to keep installing node modules. For convenience, you can run `./sdk run --fast` which will only use cached docker layers and run the `dotnet run` portion of the previous script.\n\n#### Windows\n* Ensure Windows 10 Creators update is installed (Windows 10, version 1709).\n* Enable Hardware Virtualization on your computer (likely BIOS change)\n* Install latest version 2 [Dotnet SDK](https://www.microsoft.com/net/download/windows)\n* Install [Node](https://nodejs.org/en/download/)\n* [Enable Hyper-V](https://docs.docker.com/docker-for-windows/troubleshoot/#hyper-v)\n* Install \u0026 Run [Docker](https://download.docker.com/win/stable/Docker%20for%20Windows%20Installer.exe)\n    * Make sure to allocate at least 4 GB of RAM to docker. Otherwise MSSQL won't work.\n    * Configure 'Docker Settings \u003e Shared Drives \u003e C' to be shareable\n* Increase SDK CLI permissions\n    * With your terminal/shell of choice, run `sudo chmod +x sdk` in the root of this repository\n    * Follow that up with `./sdk` to verify that it worked. If all is well, you'll see current usage information about the CLI.\n* Open the `.env` file and set STARTUP_SERVICES to be `STARTUP_SERVICES=database`\n* From the bash window (running as administrator), start up the database with docker via `./sdk run`\n* Open a second bash window (running as administrator), start up the web specifically with `./sdk run-web`\n\nAfter the script has finished, you should see the port number which the website will be using. You can open up your favorite browser and navigate to `http://localhost:PORT` OR just run `./sdk open` :).\n\nIf everything worked properly, you should be on your way to making changes, as this is hooked up to Webpack for all front-end development changes.\n\nNote: If you want to explore the SDK in more detail, simply run `./sdk` and read the available commands and examples\n\n\n## Managing the database\n\nUsing Microsoft SQL Server Management Studio use the following details:\n* Server name: `localhost,{DATABASE_PORT}` (ex. `localhost,1533`)\n    * Note: On some systems, you may need to replace `localhost` with `127.0.0.1` or `0.0.0.0`.\n* Authentication: SQL Server Authentication\n* Login: `{DATABASE_USER}` (ex. `sa`)\n* Password: `{DATABASE_PASSWORD}`\n\n\n## SDK Command Reference\n\nCommand                                  | Description\n-----------------------------------------|-----------------------------------------------\n`./sdk`                                  | Displays help describing commands and examples\n`./sdk clean`                            | Removes project related images and kills all containers based on those images\n`./sdk create-migration [migration-name]` | Create new dotnet entity framework migration.\u003cbr\u003eDoes not require valid database configuration.\n`./sdk create-release [version]`         | Builds a release build image with the supplied version\u003cbr\u003etag and deploys it to the configured docker hub repository  \n`./sdk delete-migration`                 | Removes most recent entity framework migration.\u003cbr\u003eRequires valid database configuration.\n`./sdk dotnet-build`                     | Build the dotnet solution from the root of the project. \n`./sdk dotnet-restore`                   | Restore the dotnet solution from the root of the project\n`./sdk info`                             | Shows build details (ie. user, versions)\n`./sdk open`                             | Open the application root path in your system default web browser\n`./sdk run`                              | Starts the project in debug mode. Performs re-build of docker image,\u003cbr\u003erestores npm and nuget packages and starts up docker-compose\n`./sdk run --fast`                       | Same as `run`, but skips all dependency\u003cbr\u003eand project build steps to get to execution as fast as possible\n`./sdk run --no-build`                   | Same as `run`, but skips build of docker images (leverages cache)\n`./sdk run --no-restore`                 | Same as `run`, but skips npm and nuget package restores\n`./sdk run-release`                      | Builds and starts a release build docker image\n`./sdk run-web`                          | Locally runs only the web project (not with docker).\u003cbr\u003eTypically used when developer wants to maximize backend development performance and is selectively using docker\n`./sdk run-web --no-restore`             | Same as `run-web`, but skips npm and nuget package restores\n\n\n## Future\n\n* Port sdk from bash to Node leveraging ShellJS\n* When Windows and Mac OSX prove legitimate for backend development, re-add nuget items as volumes so local editors don't have missing dependencies\n    * docker-compose.debug.yml\n        * `volumes:`\n            * `- /app/obj`\n            * `- /app/bin`\n            * `- ~/.nuget:/root/.nuget`\n            * `- /root/.nuget/packages/.tools`\n* Add support for auto-deploying to various platforms\n    * Azure\n    * Amazon\n    * Heroku\n* Example for using HAProxy for load balancing\n* Use of docker swarm\n\n\n## Troubleshooting\n\n* Changes I'm making are not being updated to the browser\n    * First off, simply try to restart you current command\n        * End the current process: `Ctrl + C`\n        * Restart: If using `--fast`, re-run `./sdk run --fast`\n    * Secondly, if that doesn't do it, try running the normal `run` via `./sdk run`\n    * Finally, if all else fails, perform a full clean and run\n        * `./sdk clean`\n        * `./sdk run`\n\n* Default ports are already in use in my machine OR I'd simply like to change it...\n    * Provided you've run the `./sdk` at least once (in any capacity), you should have a `.env` file in your project (if not, see the \".env is missing\")\n    * From here, modify either `DATABASE_PORT` and/ or `WEB_PORT`\n\n* .env file is missing!\n    * This file is automatically generated in development environments when `./sdk` is run in ANY capacity\n        * Under the hood it is simply doing a `cp .env.development.sample .env`\n    * Simply run `./sdk`, which outputs the help, and it should be created\n\n* Trying to run `dotnet run` manually\n    * Sure, you'll have to manually load the `.env` file OR set them yourself on your system. Otherwise dotnet will likely runtime error due to configuration settings missing.\n\n* Unable to bind to localhost:5XXXX on the IPv6 loopback interface\n    * Some editors will generate configuration files containing an alternative port number (ie. when you debug). Unfortunately, that file can superceed kestrels port number you set via the `DATABASE_PORT` flag.\n        * Do a recursive search through the repository on your machine for that port number (ie. 51247), remove the section from the file, and retry.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frsm-hcd%2Fdocker-dotnet-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frsm-hcd%2Fdocker-dotnet-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frsm-hcd%2Fdocker-dotnet-example/lists"}