mirror of
https://github.com/thegeeklab/wp-docker-buildx.git
synced 2024-11-10 03:30:40 +00:00
feat: add option to support buildx --label flag (#132)
This commit is contained in:
parent
fb64593ea2
commit
4171f3d711
@ -221,3 +221,8 @@ properties:
|
|||||||
description: Target platforms for build.
|
description: Target platforms for build.
|
||||||
type: list
|
type: list
|
||||||
required: false
|
required: false
|
||||||
|
|
||||||
|
labels:
|
||||||
|
description: Labels to add to the image.
|
||||||
|
type: list
|
||||||
|
required: false
|
||||||
|
@ -297,5 +297,12 @@ func settingsFlags(settings *plugin.Settings, category string) []cli.Flag {
|
|||||||
Destination: &settings.Build.Platforms,
|
Destination: &settings.Build.Platforms,
|
||||||
Category: category,
|
Category: category,
|
||||||
},
|
},
|
||||||
|
&cli.StringSliceFlag{
|
||||||
|
Name: "labels",
|
||||||
|
EnvVars: []string{"PLUGIN_LABELS"},
|
||||||
|
Usage: "labels to add to image",
|
||||||
|
Destination: &settings.Build.Labels,
|
||||||
|
Category: category,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -123,6 +123,10 @@ func commandBuild(build Build, dryrun bool) *exec.Cmd {
|
|||||||
args = append(args, "-t", fmt.Sprintf("%s:%s", build.Repo, arg))
|
args = append(args, "-t", fmt.Sprintf("%s:%s", build.Repo, arg))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for _, arg := range build.Labels.Value() {
|
||||||
|
args = append(args, "--label", arg)
|
||||||
|
}
|
||||||
|
|
||||||
return exec.Command(dockerExe, args...)
|
return exec.Command(dockerExe, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,6 +61,7 @@ type Build struct {
|
|||||||
Quiet bool // Docker build quiet
|
Quiet bool // Docker build quiet
|
||||||
Output string // Docker build output folder
|
Output string // Docker build output folder
|
||||||
NamedContext cli.StringSlice // Docker build named context
|
NamedContext cli.StringSlice // Docker build named context
|
||||||
|
Labels cli.StringSlice // Docker build labels
|
||||||
}
|
}
|
||||||
|
|
||||||
// Settings for the Plugin.
|
// Settings for the Plugin.
|
||||||
|
Loading…
Reference in New Issue
Block a user