buildx
buildx copied to clipboard
bake: load override
follow-up https://github.com/docker/buildx/pull/2330
The --load case is not properly handled in v0.13 and previous v0.12 as it doesn't append but overrides the outputs:
target "foo" {
output = [ "type=local,dest=out" ]
}
target "bar" {
}
$ docker buildx bake --load --print foo bar
{
"group": {
"default": {
"targets": [
"foo",
"bar"
]
}
},
"target": {
"bar": {
"context": ".",
"dockerfile": "Dockerfile",
"output": [
"type=docker"
]
},
"foo": {
"context": ".",
"dockerfile": "Dockerfile",
"output": [
"type=docker"
]
}
}
}
With this change it will append only if there is a compatible output already (image, registry) or empty:
{
"group": {
"default": {
"targets": [
"foo",
"bar"
]
}
},
"target": {
"bar": {
"context": ".",
"dockerfile": "Dockerfile",
"output": [
"type=docker"
]
},
"foo": {
"context": ".",
"dockerfile": "Dockerfile",
"output": [
"type=local,dest=out"
]
}
}
}
For example with:
target "foo" {
output = [ "type=image" ]
}
target "bar" {
}
It would result in:
{
"group": {
"default": {
"targets": [
"foo",
"bar"
]
}
},
"target": {
"bar": {
"context": ".",
"dockerfile": "Dockerfile",
"output": [
"type=docker"
]
},
"foo": {
"context": ".",
"dockerfile": "Dockerfile",
"output": [
"type=image"
"type=docker"
]
}
}
}
Same has been done for push override so we are consistent. See new tests suite for more info.