-
Notifications
You must be signed in to change notification settings - Fork 564
Description
Description
I have a bakefile that builds three similar production containers, call them foo, bar, baz. Building each of these involves calling the same 10+ stage Dockerfile with different parameters. In addition to that, each of the containers has some additional offshoot targets, like foo-test, foo-dev, and foo-logs (which uses a type=local
output to exfiltrate detailed build exhaust for archival). So my default bake is like:
group "default" {
targets = [
"foo", "foo-test", "foo-dev", "foo-logs",
"bar", "bar-test", ...
]
}
My issue is that while this is running locally, the stages that are "common" to the foo family of targets seem to be able to be attributed to any of them in the build spool— it's just random. This makes it confusing to know if installing the base deps installation is truly a special part of foo-test, or if it's really part of foo, and only being labeled as foo-test because foo-test extended all or most of foo.
My proposal would be that there should be some deterministic policy for how buildkit labels stages common to multiple targets, with the simplest being to just always choose the name that is the shortest in number of characters, but something more enlightened might the first one that is specified in the bake list (if that ordering information is available to buildx).
I'm on buildx 0.25.0 and docker 28.3.2