cog icon indicating copy to clipboard operation
cog copied to clipboard

Feature request: allow passing a --config option to `cog` to use a different cog.yaml

Open ericallam opened this issue 4 years ago • 7 comments

It would be nice to be able to have multiple cog.yaml files in a repo and be able to pass a --config option to the cog cli like so:

$ cog build -t image_name --config cog.dev.yaml

ericallam avatar Sep 23 '21 08:09 ericallam

👍 Great idea. Thanks for the suggestion!

Perhaps the option could be --file/-f for consistency with docker build.

For a long time we resisted adding the option to select a file to Docker. There was a reason for it, but it is fuzzy in my head. Let me try and recall why that was... @aanand do you remember?

bfirsh avatar Sep 23 '21 15:09 bfirsh

I don't think we resisted the --file argument to docker-compose necessarily, but there was certainly a lot of hesitancy over allowing multiple files to be passed in and the semantics thereof. If that's a moot point here, I don't think you have much to worry about.

aanand avatar Sep 29 '21 13:09 aanand

Right, yes. I remember all that overlaying squabbling.

I vaguely remember there was some resistance to adding it to docker build because it would mean people might put Dockerfile in a non-standard location (which people do lots now! like docker/Dockerfile). That would then mean that docker build wouldn't work by default, and Docker would have to be wrapped with a shell script, or something like that.

Interesting how Dockerfile seems to be a non-standard location fairly often, but I rarely see docker-compose.yml in a non-standard location. Maybe that's because people interact with Compose directly more often, so have less patience for it being in a non-standard location.

bfirsh avatar Sep 29 '21 16:09 bfirsh

I think that's right. It probably never mattered whether docker build with no arguments was a reliably repeatable command, because in practice it's almost always invoked by some CI system, build script, docker-compose file, etc, rather than by hand.

The question, then, is whether cog is more of a docker build-style command (overwhelmingly invoked by computers) or a docker-compose-style command (frequently invoked by humans)?

aanand avatar Sep 29 '21 19:09 aanand

(that said, it might not matter - as you point out, adding a --file argument to docker-compose doesn't seem to have resulted in a mass of people naming their Compose files something else.)

aanand avatar Sep 29 '21 19:09 aanand

Cog is a human thing like Compose, so I guess this will be fine. Thanks for your thoughts!

bfirsh avatar Sep 30 '21 16:09 bfirsh

Is it supported now?

hardikdava avatar Jun 19 '25 20:06 hardikdava