From 24db7366ba87b0a81e5bc9d02f0c62351500de35 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Sat, 8 Jan 2022 17:53:17 +0100 Subject: [PATCH 1/2] build: inline buildinfo attrs Signed-off-by: CrazyMax --- build/build.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build/build.go b/build/build.go index 1783e087..afaaa744 100644 --- a/build/build.go +++ b/build/build.go @@ -499,6 +499,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 From 4b633c3c7be3c77846cb6b51bc33a4935082fcef Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Fri, 11 Feb 2022 07:57:50 +0100 Subject: [PATCH 2/2] docs: built-in build args Signed-off-by: CrazyMax --- docs/reference/buildx_build.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/reference/buildx_build.md b/docs/reference/buildx_build.md index 49b24d02..947b6385 100644 --- a/docs/reference/buildx_build.md +++ b/docs/reference/buildx_build.md @@ -54,6 +54,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 ### Override the configured builder instance (--builder)