I have 3 configs in service:
1 - appsettings.development.json
2 - appsettings.testing.json
3 - appsettings.production.json
And i have 3 launch settings for them as well in launchsettings.json:
{
"profiles": {
"DevelopmentDockerProfile" {
"commandName": "Docker",
"environmentVariables": {
"DOTNET_ENVIRONMENT": "development"
}
},
"ProductionDockerProfile" {
"commandName": "Docker",
"environmentVariables": {
"DOTNET_ENVIRONMENT": "production"
}
},
"TestingDockerProfile" {
"commandName": "Docker",
"environmentVariables": {
"DOTNET_ENVIRONMENT": "testing"
}
}
}
}
And i can normally run service, using correct configuration only on local machine.
I can not push DOTNET_ENVIRONMENT variable with service when publishing.
Is there any way to bind environment variable to publishProfile.pubxml or whatever else, that environment variable DOTNET_ENVIRONMENT will magically appear in docker service on host machine?