Skip to content

New environment variable to specify bake file(s) #3218

Open
@rrjjvv

Description

@rrjjvv

Description

It would be nice to have an environment variable like BAKE_FILE, analogous to COMPOSE_FILE in compose, to allow specifying the bake file(s) to execute. For example, I'd like to replace

$ docker buildx bake -f docker-bake.hcl -f docker-bake.test.hcl <target>

with

$ export BAKE_FILE='docker-bake.hcl:docker-bake.test.hcl'
$ docker buildx bake <target>

My actual problem (annoyance) is having to continually specify two -f arguments for every command. For readability, I chose to split up my primary targets from my targets dedicated to testing. I know I could technically solve this simply renaming my second file to docker-bake.override.hcl. But in reality, it's not an override file; it's 100% additive with no overriding or merging. Even though the second file is additive, it's not independent; it uses functions defined in the primary file, which is why I have to specify both files in order to build a target in the second.

Something like import: "docker-bake.test.hcl" would also solve my problem. Obviously that also has precedent in compose (and would actually be even cleaner/friendlier in my case), but I assumed the environment variable would be more likely to get a thumbs up, and of course, much simpler to implement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions