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

feat: add output option to set the export action for build results (#71)

This commit is contained in:
Martin Honermeyer 2022-01-27 21:53:46 +01:00 committed by GitHub
parent 25c057585e
commit ee13dd891e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 1 deletions

View File

@ -142,6 +142,9 @@ pull_image
compress compress
: enables compression og the build context using gzip : enables compression og the build context using gzip
output
: sets output folder for build artifacts (format: `path` or `type=TYPE[,KEY=VALUE]`)
repo repo
: sets repository name for the image : sets repository name for the image

View File

@ -150,6 +150,12 @@ func settingsFlags(settings *plugin.Settings) []cli.Flag {
Usage: "enables suppression of the build output", Usage: "enables suppression of the build output",
Destination: &settings.Build.Quiet, Destination: &settings.Build.Quiet,
}, },
&cli.StringFlag{
Name: "output",
EnvVars: []string{"PLUGIN_OUTPUT"},
Usage: "sets build output folder",
Destination: &settings.Build.Output,
},
&cli.StringFlag{ &cli.StringFlag{
Name: "target", Name: "target",
EnvVars: []string{"PLUGIN_TARGET"}, EnvVars: []string{"PLUGIN_TARGET"},

View File

@ -84,7 +84,7 @@ func commandBuild(build Build, dryrun bool) *exec.Cmd {
} }
args = append(args, build.Context) args = append(args, build.Context)
if !dryrun && len(build.Tags.Value()) > 0 { if !dryrun && build.Output == "" && len(build.Tags.Value()) > 0 {
args = append(args, "--push") args = append(args, "--push")
} }
if build.Compress { if build.Compress {
@ -114,6 +114,9 @@ func commandBuild(build Build, dryrun bool) *exec.Cmd {
if build.Quiet { if build.Quiet {
args = append(args, "--quiet") args = append(args, "--quiet")
} }
if build.Output != "" {
args = append(args, "--output", build.Output)
}
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()[:], ","))

View File

@ -59,6 +59,7 @@ type Build struct {
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
} }
// Settings for the Plugin. // Settings for the Plugin.