With moby/buildkit#2879 close to merging, I thought I'd propose some new syntax here 🎉
When merged, it'll be possible to use annotations as follows (with no changes to buildx):
docker buildx build . --output type=image,name=example/foo,push=true,annotation.x=1 --platform=linux/arm64,linux/amd64
However, this isn't ideal, and it would be nice to provide a shorthand, similar to how --push appends push=true.
Buildx
For buildx, we can provide the --annotation flag:
docker buildx build . --output type=image,name=example/foo,push=true --annotation x=1 --platform=linux/arm64,linux/amd64
For platform-specific annotations, we can allow prefixing with the platform name:
docker buildx build . --output type=image,name=example/foo,push=true --annotation linux/amd64:x=1 --platform=linux/arm64,linux/amd64
Not super sure about the exact syntax, but something along those lines should work.
I think we should explicitly avoid allowing using anything other than the manifest annotation type, directing users to manually add the output attribute if they want more advanced behavior.
Bake
For bake, we can add an annotations key:
target "x" {
...
annotations = {
"linux/amd64:x" = "1"
}
...
}
Comments appreciated 🎉
With moby/buildkit#2879 close to merging, I thought I'd propose some new syntax here 🎉
When merged, it'll be possible to use annotations as follows (with no changes to buildx):
However, this isn't ideal, and it would be nice to provide a shorthand, similar to how
--pushappendspush=true.Buildx
For buildx, we can provide the
--annotationflag:For platform-specific annotations, we can allow prefixing with the platform name:
Not super sure about the exact syntax, but something along those lines should work.
I think we should explicitly avoid allowing using anything other than the
manifestannotation type, directing users to manually add the output attribute if they want more advanced behavior.Bake
For bake, we can add an
annotationskey:Comments appreciated 🎉