Xaxum
Xaxum

Reputation: 3675

visual studio 2017 docker-compose override and prod actions on build

To my understanding from the Visual studio multi environment docker docs here you can have multiple yml files for each of your environments. It says that the docker-compose.override.yml is used for development. I created a docker-compose.prod.yml like it says in this link but it doesn't run when I build under release, override continues to run. I am following the directions here which says to change configuration to release and build which should build the project for prod.

Not sure if this is related but I also noticed the prod is not nested like override is in the project. DockerCompose non nested prod

I need to have two different compose files for prod and for dev but it seems override is not ignored when building for release and prod is not used.

Any ideas on how to get two different docker-compose files based on the environment? Just changing to release and building doesn't work as expected. Is the only way to do command line? Also, why doesn't prod nest?

docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d

Upvotes: 4

Views: 2186

Answers (1)

Wan Kenobi
Wan Kenobi

Reputation: 53

A little late to the party but I faced the same challenge and found the solution below, hope it helps someone else out there.

If you want different behavior based on the build configuration (for example, Debug or Release), add configuration-specific docker-compose files. The files should be named according to the build configuration (for example, docker-compose.vs.debug.yml and docker-compose.vs.release.yml) and placed in the same location as the docker-compose-override.yml file.

More info here

Upvotes: 4

Related Questions