up icon indicating copy to clipboard operation
up copied to clipboard

Support multiple `docker_compose_command`s

Open KCErb opened this issue 5 years ago • 1 comments

If you're using a docker-compose version > 2, then the way to share configurations is by layering compose files.

So when spinning up a test env I might use

docker-compose -f base.yml -f test.yml

And when spinning up a dev environment I might use

docker-compose -f base.yml -f dev.yml

I can think of a couple of features that would make this more convenient. For one, right now running up compose uses the docker_compose_command in up.yml perhaps we could support a flag, I'm not sure about the yaml but I'm imagining

docker_compose_commands:
  default: docker-compose -f docker-compose.yml -f docker-compose.dev.yml
  test: docker-compose -f docker-compose.yml -f docker-compose.test.yml

then

up compose --test -d

which should be equivalent to

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

with a --build flag if a rebuild is needed.

If that's too much, a simpler feature that would meet my needs would be a tool for asking up to rebuild if needed. Then I could use it more generally

up --check
docker-compose -f docker-compose.yml -f docker-compose.test.yml up -d

KCErb avatar Apr 21 '20 12:04 KCErb

Little update here: So far, layering a test yml hasn't actually worked out in practice. So the above won't help me though I see the value in the idea still.

KCErb avatar Apr 22 '20 10:04 KCErb