Add overwrite strategy options to config by CarstenHoyer · Pull Request #3939 · docker/compose

For now - without the ability to overwrite objects - we instead have to move the ports and other complex objects into yet another file, which we can cascade e.g.:

# docker-compose.yml
...
  some-svc:
    image: xyz:${RELEASE:-latest}
...
# docker-compose.prod.yml
...
  some-svc:
    env:
      - "X=y"
...
# docker-compose.local-ports.yml
...
  some-svc:
    ports:
      - "3000:3000"
...
# docker-compose.ci.yml
...
  some-integration-test-svc:
    ...
...

Generate a "production" (🤷) config to ship somewhere:

COMPOSE_FILE="docker-compose.yml:docker-compose.prod.yml" docker-compose config > docker-compose.${RELEASE}.conf

Run a composition for dev:

COMPOSE_FILE="docker-compose.yml:docker-compose.ports.yml" docker-compose up

Run a composition for some integration test:

COMPOSE_FILE="docker-compose.yml:docker-compose.ports.yml:docker-compose.ci.yml" docker-compose up --build --abort-on-container-exit

Not the end of the world, but a bit annoying.