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

fix: allow multi-platform builds using --push flag (#29)

This commit is contained in:
Robert Kaussow 2021-06-16 22:21:00 +02:00 committed by GitHub
parent 562ee26fda
commit a6cc96fbda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -65,7 +65,6 @@ func commandBuild(build Build) *exec.Cmd {
args := []string{ args := []string{
"buildx", "buildx",
"build", "build",
"--load",
"--rm=true", "--rm=true",
"-f", build.Dockerfile, "-f", build.Dockerfile,
"-t", build.Name, "-t", build.Name,
@ -107,6 +106,12 @@ func commandBuild(build Build) *exec.Cmd {
args = append(args, "--quiet") args = append(args, "--quiet")
} }
if len(build.Platforms.Value()) > 1 {
args = append(args, "--push")
} else {
args = append(args, "--load")
}
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

@ -83,6 +83,10 @@ func (p *Plugin) Validate() error {
p.settings.Build.Ref = p.pipeline.Commit.Ref p.settings.Build.Ref = p.pipeline.Commit.Ref
p.settings.Daemon.Registry = p.settings.Login.Registry p.settings.Daemon.Registry = p.settings.Login.Registry
if len(p.settings.Build.Platforms.Value()) > 1 && p.settings.Dryrun {
return fmt.Errorf("dryrun is not supported on multi-platform builds")
}
if p.settings.Build.TagsAuto { if p.settings.Build.TagsAuto {
// return true if tag event or default branch // return true if tag event or default branch
if UseDefaultTag( if UseDefaultTag(