From adf8f25aa276e9365e0e83d3085dd8767dfb9834 Mon Sep 17 00:00:00 2001 From: Brian Goff Date: Wed, 17 Feb 2021 21:47:04 +0000 Subject: [PATCH] Support BUILDKIT_MULTI_PLATFORM arg in Dockerfile This sets the platform prefix based on the `BUILDKIT_MULTI_PLATFORM` value (if set). This is similar to the changes here in docker/buildx@7f58ad45fab9ab0e8c961cac6599ce0e8b100ad2 Signed-off-by: Brian Goff --- frontend/dockerfile/builder/build.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frontend/dockerfile/builder/build.go b/frontend/dockerfile/builder/build.go index 345e7898490f..5e67a83370e8 100644 --- a/frontend/dockerfile/builder/build.go +++ b/frontend/dockerfile/builder/build.go @@ -54,6 +54,7 @@ const ( keyContextSubDir = "contextsubdir" keyContextKeepGitDir = "build-arg:BUILDKIT_CONTEXT_KEEP_GIT_DIR" keySyntax = "build-arg:BUILDKIT_SYNTAX" + keyMultiPlatformArg = "build-arg:BUILDKIT_MULTI_PLATFORM" keyHostname = "hostname" ) @@ -369,6 +370,9 @@ func Build(ctx context.Context, c client.Client) (*client.Result, error) { exportMap := len(targetPlatforms) > 1 + if v := opts[keyMultiPlatformArg]; v != "" { + opts[keyMultiPlatform] = v + } if v := opts[keyMultiPlatform]; v != "" { b, err := strconv.ParseBool(v) if err != nil {