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
|
type: string
|
||||||
required: false
|
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:
|
tags:
|
||||||
description: Set repository tags to use for the image. Tags can also be loaded from a `.tags` file.
|
description: Set repository tags to use for the image. Tags can also be loaded from a `.tags` file.
|
||||||
defaultValue: latest
|
defaultValue: latest
|
||||||
|
@ -128,6 +128,13 @@ func settingsFlags(settings *plugin.Settings, category string) []cli.Flag {
|
|||||||
Destination: &settings.Build.Context,
|
Destination: &settings.Build.Context,
|
||||||
Category: category,
|
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{
|
&cli.StringSliceFlag{
|
||||||
Name: "tags",
|
Name: "tags",
|
||||||
EnvVars: []string{"PLUGIN_TAG", "PLUGIN_TAGS"},
|
EnvVars: []string{"PLUGIN_TAG", "PLUGIN_TAGS"},
|
||||||
|
@ -117,6 +117,9 @@ func commandBuild(build Build, dryrun bool) *exec.Cmd {
|
|||||||
if build.Output != "" {
|
if build.Output != "" {
|
||||||
args = append(args, "--output", 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 {
|
if len(build.Platforms.Value()) > 0 {
|
||||||
args = append(args, "--platform", strings.Join(build.Platforms.Value(), ","))
|
args = append(args, "--platform", strings.Join(build.Platforms.Value(), ","))
|
||||||
|
@ -40,25 +40,26 @@ type Login struct {
|
|||||||
|
|
||||||
// Build defines Docker build parameters.
|
// Build defines Docker build parameters.
|
||||||
type Build struct {
|
type Build struct {
|
||||||
Ref string // Git commit ref
|
Ref string // Git commit ref
|
||||||
Branch string // Git repository branch
|
Branch string // Git repository branch
|
||||||
Dockerfile string // Docker build Dockerfile
|
Dockerfile string // Docker build Dockerfile
|
||||||
Context string // Docker build context
|
Context string // Docker build context
|
||||||
TagsAuto bool // Docker build auto tag
|
TagsAuto bool // Docker build auto tag
|
||||||
TagsSuffix string // Docker build tags with suffix
|
TagsSuffix string // Docker build tags with suffix
|
||||||
Tags cli.StringSlice // Docker build tags
|
Tags cli.StringSlice // Docker build tags
|
||||||
Platforms cli.StringSlice // Docker build target platforms
|
Platforms cli.StringSlice // Docker build target platforms
|
||||||
Args cli.StringSlice // Docker build args
|
Args cli.StringSlice // Docker build args
|
||||||
ArgsEnv cli.StringSlice // Docker build args from env
|
ArgsEnv cli.StringSlice // Docker build args from env
|
||||||
Target string // Docker build target
|
Target string // Docker build target
|
||||||
Pull bool // Docker build pull
|
Pull bool // Docker build pull
|
||||||
CacheFrom cli.StringSlice // Docker build cache-from
|
CacheFrom cli.StringSlice // Docker build cache-from
|
||||||
Compress bool // Docker build compress
|
Compress bool // Docker build compress
|
||||||
Repo string // Docker build repository
|
Repo string // Docker build repository
|
||||||
NoCache bool // Docker build no-cache
|
NoCache bool // Docker build no-cache
|
||||||
AddHost cli.StringSlice // Docker build add-host
|
AddHost cli.StringSlice // Docker build add-host
|
||||||
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
|
||||||
}
|
}
|
||||||
|
|
||||||
// Settings for the Plugin.
|
// Settings for the Plugin.
|
||||||
|
Loading…
Reference in New Issue
Block a user