Skip to content

Commit af094c3

Browse files
committed
bugfix: when in fastbuild, don't build for ALL platforms
1 parent fadd8f5 commit af094c3

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

cmd/bob/build.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,16 @@ func buildAndPushOneDockerImage(dockerImage bobfile.DockerImageSpec, buildCtx *B
207207
"--tag=" + tag,
208208
}
209209

210-
if len(dockerImage.Platforms) > 0 {
211-
args = append(args, "--platform="+strings.Join(dockerImage.Platforms, ","))
210+
platformsToBuildFor := func() []string {
211+
if buildCtx.FastBuild {
212+
return nil // don't specify platform explicitly => Docker assumes currently running platform
213+
} else {
214+
return dockerImage.Platforms
215+
}
216+
}()
217+
218+
for _, platformToBuildFor := range platformsToBuildFor {
219+
args = append(args, "--platform="+platformToBuildFor)
212220
}
213221

214222
// https://docs.docker.com/reference/cli/docker/buildx/build/#annotation

0 commit comments

Comments
 (0)