feat: set DOCKER_IMAGE_CREATED as build-arg

This commit is contained in:
Robert Kaussow 2021-01-22 12:58:44 +01:00
parent 90bd543091
commit 23a6c79fbd
No known key found for this signature in database
GPG Key ID: 65362AE74AF98B61

View File

@ -5,6 +5,7 @@ import (
"os" "os"
"os/exec" "os/exec"
"strings" "strings"
"time"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
) )
@ -60,6 +61,10 @@ func commandBuild(build Build) *exec.Cmd {
"-t", build.Name, "-t", build.Name,
} }
defaultBuildArgs := []string{
fmt.Sprintf("DOCKER_IMAGE_CREATED=%s", time.Now().Format(time.RFC3339)),
}
args = append(args, build.Context) args = append(args, build.Context)
if build.Squash { if build.Squash {
args = append(args, "--squash") args = append(args, "--squash")
@ -79,7 +84,7 @@ func commandBuild(build Build) *exec.Cmd {
for _, arg := range build.ArgsEnv.Value() { for _, arg := range build.ArgsEnv.Value() {
addProxyValue(&build, arg) addProxyValue(&build, arg)
} }
for _, arg := range build.Args.Value() { for _, arg := range append(defaultBuildArgs, build.Args.Value()...) {
args = append(args, "--build-arg", arg) args = append(args, "--build-arg", arg)
} }
for _, host := range build.AddHost.Value() { for _, host := range build.AddHost.Value() {