mirror of
https://github.com/thegeeklab/drone-docker-buildx.git
synced 2024-11-05 04:20:41 +00:00
allow flag --target in build process
This commit is contained in:
parent
af4a2586ce
commit
86388a5be3
@ -146,6 +146,11 @@ func main() {
|
||||
Usage: "build args",
|
||||
EnvVar: "PLUGIN_BUILD_ARGS_FROM_ENV",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "target",
|
||||
Usage: "build target",
|
||||
EnvVar: "PLUGIN_BUILD_TARGET",
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "squash",
|
||||
Usage: "squash the layers at build time",
|
||||
@ -227,6 +232,7 @@ func run(c *cli.Context) error {
|
||||
Tags: c.StringSlice("tags"),
|
||||
Args: c.StringSlice("args"),
|
||||
ArgsEnv: c.StringSlice("args-from-env"),
|
||||
Target: c.String("target"),
|
||||
Squash: c.Bool("squash"),
|
||||
Pull: c.BoolT("pull-image"),
|
||||
Compress: c.Bool("compress"),
|
||||
|
@ -44,6 +44,7 @@ type (
|
||||
Tags []string // Docker build tags
|
||||
Args []string // Docker build args
|
||||
ArgsEnv []string // Docker build args from env
|
||||
Target string // Docker build target
|
||||
Squash bool // Docker build squash
|
||||
Pull bool // Docker build pull
|
||||
Compress bool // Docker build compress
|
||||
@ -204,6 +205,9 @@ func commandBuild(build Build) *exec.Cmd {
|
||||
for _, arg := range build.Args {
|
||||
args = append(args, "--build-arg", arg)
|
||||
}
|
||||
if build.Target != "" {
|
||||
args = append(args, "--target", build.Target)
|
||||
}
|
||||
|
||||
labelSchema := []string{
|
||||
fmt.Sprintf("build-date=%s", time.Now().Format(time.RFC3339)),
|
||||
|
Loading…
Reference in New Issue
Block a user