1. Asp.net Core Environment
You can follow by this article from Microsoft to deeply understand about multi environment for .net core app.
Use multiple environments in ASP.NET Core
Learn how to control app behavior across multiple environments in ASP.NET Core apps.
But I can summary here:
- Asp.net Core provides 3 environment stages:
- Your setting file will be stored at
- We need to set
ASPNETCORE_ENVIRONMENTwhen build the application
Assume our application will have two deploys :
- Production with
- Staging with
2. Let start
Assume you have a new app which was created by
dotnet new webapi — name dotnet_demo_webapi .
- Firstly, you need to update
Startup.csfile to load
- Second, Add your
Dockerfilemaybe like below:
- Finally, because we need to build 2 versions (Staging and Production) so we will use
docker-compose.ymlto manage servies, you can read docks here:
Compose is a tool for defining and running multi-container Docker applications. To learn more about Compose refer to…
After that run
docker-compose up --build -d to build images and run services.
Any questions you can comment below, thanks for reading.
Asp.net Core & Docker example: