mirror of
https://github.com/thegeeklab/wp-docker-buildx.git
synced 2024-11-25 09:10:39 +00:00
fix: allow multi-platform builds using --push flag (#29)
This commit is contained in:
parent
562ee26fda
commit
a6cc96fbda
@ -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()[:], ","))
|
||||||
}
|
}
|
||||||
|
@ -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(
|
||||||
|
Loading…
Reference in New Issue
Block a user