0
0
mirror of https://github.com/thegeeklab/wp-docker-buildx.git synced 2024-11-09 17:20:39 +00:00

append users build-args to the default slice

This commit is contained in:
Robert Kaussow 2021-01-22 12:57:32 +01:00
parent 113599ff08
commit 410d80eb98
No known key found for this signature in database
GPG Key ID: 65362AE74AF98B61

View File

@ -71,6 +71,10 @@ func commandBuild(build Build) *exec.Cmd {
"-t", build.Name,
}
defaultBuildArgs := []string{
fmt.Sprintf("DOCKER_IMAGE_CREATED=%s", time.Now().Format(time.RFC3339)),
}
args = append(args, build.Context)
if build.Squash {
args = append(args, "--squash")
@ -90,7 +94,7 @@ func commandBuild(build Build) *exec.Cmd {
for _, arg := range build.ArgsEnv.Value() {
addProxyValue(&build, arg)
}
for _, arg := range build.Args.Value() {
for _, arg := range append(defaultBuildArgs, build.Args.Value()...) {
args = append(args, "--build-arg", arg)
}
for _, host := range build.AddHost.Value() {
@ -107,9 +111,6 @@ func commandBuild(build Build) *exec.Cmd {
args = append(args, "--platform", strings.Join(build.Platforms.Value()[:], ","))
}
// append generated build args
args = append(args, "--build-arg", fmt.Sprintf("DOCKER_IMAGE_CREATED=%s", time.Now().Format(time.RFC3339)))
return exec.Command(dockerExe, args...)
}