Hacker News new | ask | show | jobs
by number6 590 days ago
I do it the other way round, so in production you just have to use `docker compose up`. I did not understand the `compose.yaml:compose.prod.yaml` syntax or never saw it. What does this do?
1 comments

Oh if you set the environment variable COMPOSE_FILE, you can specify a colon-separated list of compose files, which get merged together. This lets us have our core services in our main compose.yaml, since they're shared between dev and production, and then have extra services that are prod-only, or toggle certain prod-only environment variables, inside the compose.prod.yaml . And extra services/settings which we only want in the dev environment go in compose.override.yaml .

Eg

    COMPOSE_FILE="compose.yaml:compose.prod.yaml" docker compose up
My work is OS so you can check it out here if you wish: https://github.com/internetarchive/openlibrary/