mirror of
https://github.com/thegeeklab/drone-docker.git
synced 2024-11-23 21:30:39 +00:00
feat: set DOCKER_IMAGE_CREATED as build-arg
This commit is contained in:
parent
90bd543091
commit
23a6c79fbd
@ -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() {
|
||||||
|
Loading…
Reference in New Issue
Block a user