diff --git a/plugin/docker.go b/plugin/docker.go index d7900f4..8350d48 100644 --- a/plugin/docker.go +++ b/plugin/docker.go @@ -65,7 +65,6 @@ func commandBuild(build Build) *exec.Cmd { args := []string{ "buildx", "build", - "--load", "--rm=true", "-f", build.Dockerfile, "-t", build.Name, @@ -107,6 +106,12 @@ func commandBuild(build Build) *exec.Cmd { 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 { args = append(args, "--platform", strings.Join(build.Platforms.Value()[:], ",")) } diff --git a/plugin/impl.go b/plugin/impl.go index e8c249e..6e0464e 100644 --- a/plugin/impl.go +++ b/plugin/impl.go @@ -83,6 +83,10 @@ func (p *Plugin) Validate() error { p.settings.Build.Ref = p.pipeline.Commit.Ref 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 { // return true if tag event or default branch if UseDefaultTag(