0
0
mirror of https://github.com/thegeeklab/wp-docker-buildx.git synced 2024-11-09 17:20: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
: enables compression og the build context using gzip
output
: sets output folder for build artifacts (format: `path` or `type=TYPE[,KEY=VALUE]`)
repo
: 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",
Destination: &settings.Build.Quiet,
},
&cli.StringFlag{
Name: "output",
EnvVars: []string{"PLUGIN_OUTPUT"},
Usage: "sets build output folder",
Destination: &settings.Build.Output,
},
&cli.StringFlag{
Name: "target",
EnvVars: []string{"PLUGIN_TARGET"},

View File

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

View File

@ -59,6 +59,7 @@ type Build struct {
NoCache bool // Docker build no-cache
AddHost cli.StringSlice // Docker build add-host
Quiet bool // Docker build quiet
Output string // Docker build output folder
}
// Settings for the Plugin.