Skip to content

Commit 5e61c62

Browse files
committed
collect services to build using WithServices
Signed-off-by: Nicolas De Loof <[email protected]>
1 parent fb3868f commit 5e61c62

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

pkg/compose/build.go

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
"fmt"
2323
"os"
2424
"path/filepath"
25-
"sync"
2625

2726
"github.com/moby/buildkit/util/progress/progressui"
2827

@@ -80,30 +79,19 @@ func (s *composeService) build(ctx context.Context, project *types.Project, opti
8079

8180
imageIDs := map[string]string{}
8281
serviceToBeBuild := map[string]serviceToBuild{}
83-
mapServiceMutx := sync.Mutex{}
84-
err = InDependencyOrder(ctx, project, func(ctx context.Context, name string) error {
85-
if len(options.Services) > 0 && !utils.Contains(options.Services, name) {
86-
return nil
87-
}
88-
service := project.Services[name]
89-
82+
err = project.WithServices(options.Services, func(service types.ServiceConfig) error {
9083
if service.Build == nil {
9184
return nil
9285
}
93-
9486
image := api.GetImageNameOrDefault(service, project.Name)
9587
_, localImagePresent := localImages[image]
9688
if localImagePresent && service.PullPolicy != types.PullPolicyBuild {
9789
return nil
9890
}
99-
mapServiceMutx.Lock()
91+
name := service.Name
10092
serviceToBeBuild[name] = serviceToBuild{name: name, service: service}
101-
mapServiceMutx.Unlock()
10293
return nil
103-
}, func(traversal *graphTraversal) {
104-
traversal.maxConcurrency = s.maxConcurrency
105-
})
106-
94+
}, types.IgnoreDependencies)
10795
if err != nil || len(serviceToBeBuild) == 0 {
10896
return imageIDs, err
10997
}

0 commit comments

Comments
 (0)