mirror of
https://github.com/thegeeklab/wp-docker-buildx.git
synced 2024-11-22 00:00:40 +00:00
fix: add option to set additional build contexts (#116)
This commit is contained in:
parent
734b782608
commit
b08866cc0b
@ -89,6 +89,11 @@ properties:
|
||||
type: string
|
||||
required: false
|
||||
|
||||
named_context:
|
||||
description: Set additional named [build contexts](https://docs.docker.com/engine/reference/commandline/buildx_build/#build-context) (e.g., name=path).
|
||||
type: list
|
||||
required: false
|
||||
|
||||
tags:
|
||||
description: Set repository tags to use for the image. Tags can also be loaded from a `.tags` file.
|
||||
defaultValue: latest
|
||||
|
@ -128,6 +128,13 @@ func settingsFlags(settings *plugin.Settings, category string) []cli.Flag {
|
||||
Destination: &settings.Build.Context,
|
||||
Category: category,
|
||||
},
|
||||
&cli.StringSliceFlag{
|
||||
Name: "named-context",
|
||||
EnvVars: []string{"PLUGIN_NAMED_CONTEXT"},
|
||||
Usage: "additional named build context",
|
||||
Destination: &settings.Build.NamedContext,
|
||||
Category: category,
|
||||
},
|
||||
&cli.StringSliceFlag{
|
||||
Name: "tags",
|
||||
EnvVars: []string{"PLUGIN_TAG", "PLUGIN_TAGS"},
|
||||
|
@ -117,6 +117,9 @@ func commandBuild(build Build, dryrun bool) *exec.Cmd {
|
||||
if build.Output != "" {
|
||||
args = append(args, "--output", build.Output)
|
||||
}
|
||||
for _, arg := range build.NamedContext.Value() {
|
||||
args = append(args, "--build-context", arg)
|
||||
}
|
||||
|
||||
if len(build.Platforms.Value()) > 0 {
|
||||
args = append(args, "--platform", strings.Join(build.Platforms.Value(), ","))
|
||||
|
@ -59,6 +59,7 @@ type Build struct {
|
||||
AddHost cli.StringSlice // Docker build add-host
|
||||
Quiet bool // Docker build quiet
|
||||
Output string // Docker build output folder
|
||||
NamedContext cli.StringSlice // Docker build named context
|
||||
}
|
||||
|
||||
// Settings for the Plugin.
|
||||
|
Loading…
Reference in New Issue
Block a user