Skip to content

Commit

Permalink
useDockerDefaultOrServicePlatform fct should return service.platform …
Browse files Browse the repository at this point in the history
…if defined

and present in the build.platforms list (or if the list is empty)

Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
  • Loading branch information
glours committed Nov 24, 2022
1 parent c3e5e49 commit 0ee9afa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/compose/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -415,8 +415,8 @@ func useDockerDefaultOrServicePlatform(project *types.Project, service types.Ser
return plats, err
}

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

0 comments on commit 0ee9afa

Please sign in to comment.