Reputation: 2453
I have environment wise appsettings.json and one Dokcerfile in solution.
Should I now build environment wise separate images? If so, Is it possible to use this single Dockerfile to create environment wise docker images? Actually I want to know what is the best approach. I am using asp.net core.
Upvotes: 0
Views: 628
Reputation: 96
If possible, the best solution would be to have a single docker image that is built from a single Dockerfile, and then configuration happens entirely from the environment variables that are injected into the container at runtime. It is common to store these environment variables in a .env
file (you could have a dev.env
, stage.env
, prod.env
file, etc.) and then you could pick which one to use when you start the container with the docker container run
flag --env-file
.
Upvotes: 1