diff --git a/build/build.go b/build/build.go index b7282672..ae054d27 100644 --- a/build/build.go +++ b/build/build.go @@ -505,6 +505,12 @@ func toSolveOpt(ctx context.Context, d driver.Driver, multiDriver bool, opt Opti } } } + if e.Type == "docker" || e.Type == "image" || e.Type == "oci" { + // inline buildinfo attrs from build arg + if v, ok := opt.BuildArgs["BUILDKIT_INLINE_BUILDINFO_ATTRS"]; ok { + e.Attrs["buildinfo-attrs"] = v + } + } } so.Exports = opt.Exports diff --git a/docs/reference/buildx_build.md b/docs/reference/buildx_build.md index 228a41d2..607cdf8c 100644 --- a/docs/reference/buildx_build.md +++ b/docs/reference/buildx_build.md @@ -56,6 +56,18 @@ For documentation on most of these flags, refer to the [`docker build` documentation](https://docs.docker.com/engine/reference/commandline/build/). In here we’ll document a subset of the new flags. +### Built-in build args + +* `BUILDKIT_INLINE_BUILDINFO_ATTRS=` inline build info attributes in image config or not +* `BUILDKIT_INLINE_CACHE=` inline cache metadata to image config or not +* `BUILDKIT_MULTI_PLATFORM=` opt into determnistic output regardless of multi-platform output or not + +```shell +docker buildx build --build-arg BUILDKIT_MULTI_PLATFORM=1 . +``` + +Other useful built-in args can be found in [dockerfile frontend docs](https://github.com/moby/buildkit/blob/master/frontend/dockerfile/docs/syntax.md#built-in-build-args). + ## Examples ### Allow extra privileged entitlement (--allow)