Skip to content

Commit 10a5d99

Browse files
gloursndeloof
authored andcommitted
useDockerDefaultOrServicePlatform fct should return service.platform if defined
and present in the build.platforms list (or if the list is empty) Signed-off-by: Guillaume Lours <[email protected]>
1 parent c3e5e49 commit 10a5d99

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/compose/build.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,8 +415,8 @@ func useDockerDefaultOrServicePlatform(project *types.Project, service types.Ser
415415
return plats, err
416416
}
417417

418-
if service.Platform != "" && !utils.StringContains(service.Build.Platforms, service.Platform) {
419-
if len(service.Build.Platforms) > 0 {
418+
if service.Platform != "" {
419+
if len(service.Build.Platforms) > 0 && !utils.StringContains(service.Build.Platforms, service.Platform) {
420420
return nil, fmt.Errorf("service.platform %q should be part of the service.build.platforms: %q", service.Platform, service.Build.Platforms)
421421
}
422422
// User defined a service platform and no build platforms, so we should keep the one define on the service level

0 commit comments

Comments
 (0)