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

add build_args_from_env parameter

This commit is contained in:
Brad Rydzewski 2017-08-27 16:28:58 -07:00
parent f25b013937
commit 2c6cbdba0d
2 changed files with 10 additions and 0 deletions

View File

@ -126,6 +126,11 @@ func main() {
Usage: "build args",
EnvVar: "PLUGIN_BUILD_ARGS",
},
cli.StringSliceFlag{
Name: "args-from-env",
Usage: "build args",
EnvVar: "PLUGIN_BUILD_ARGS_FROM_ENV",
},
cli.BoolFlag{
Name: "squash",
Usage: "squash the layers at build time",
@ -195,6 +200,7 @@ func run(c *cli.Context) error {
Context: c.String("context"),
Tags: c.StringSlice("tags"),
Args: c.StringSlice("args"),
ArgsEnv: c.StringSlice("args-from-env"),
Squash: c.Bool("squash"),
Pull: c.BoolT("pull-image"),
Compress: c.Bool("compress"),

View File

@ -43,6 +43,7 @@ type (
Context string // Docker build context
Tags []string // Docker build tags
Args []string // Docker build args
ArgsEnv []string // Docker build args from env
Squash bool // Docker build squash
Pull bool // Docker build pull
Compress bool // Docker build compress
@ -194,6 +195,9 @@ func commandBuild(build Build) *exec.Cmd {
if build.Pull {
args = append(args, "--pull=true")
}
for _, arg := range build.ArgsEnv {
addProxyValue(&build, arg)
}
for _, arg := range build.Args {
args = append(args, "--build-arg", arg)
}