Add support for docker --platform flag

Add a --platform flag so that the user can specify a value for the
corresponding flag passed to docker. This is useful in the context of
multi-arch builds and buildkit (DOCKER_BUILDKIT=1 in the environment).

Signed-off-by: Marcelo E. Magallon <marcelo.magallon@grafana.com>
This commit is contained in:
Marcelo E. Magallon
2022-06-01 17:21:08 -06:00
committed by TP Honey
parent 0d40d7fa5a
commit 5a691ae1e4
3 changed files with 31 additions and 0 deletions

View File

@@ -114,6 +114,27 @@ func TestCommandBuild(t *testing.T) {
".",
),
},
{
name: "platform argument",
build: Build{
Name: "plugins/drone-docker:latest",
Dockerfile: "Dockerfile",
Context: ".",
Platform: "test/platform",
},
want: exec.Command(
dockerExe,
"build",
"--rm=true",
"-f",
"Dockerfile",
"-t",
"plugins/drone-docker:latest",
".",
"--platform",
"test/platform",
),
},
}
for _, tc := range tcs {