@@ -51,14 +51,16 @@ func (s *composeService) build(ctx context.Context, project *types.Project, opti
51
51
opts := map [string ]build.Options {}
52
52
args := flatten (options .Args .Resolve (envResolver (project .Environment )))
53
53
54
- services , err := project .GetServices (options .Services ... )
55
- if err != nil {
56
- return err
57
- }
58
-
59
- for _ , service := range services {
54
+ return InDependencyOrder (ctx , project , func (ctx context.Context , name string ) error {
55
+ if len (options .Services ) > 0 && ! utils .Contains (options .Services , name ) {
56
+ return nil
57
+ }
58
+ service , err := project .GetService (name )
59
+ if err != nil {
60
+ return err
61
+ }
60
62
if service .Build == nil {
61
- continue
63
+ return nil
62
64
}
63
65
imageName := api .GetImageNameOrDefault (service , project .Name )
64
66
buildOptions , err := s .toBuildOptions (project , service , imageName , options .SSHs )
@@ -91,10 +93,11 @@ func (s *composeService) build(ctx context.Context, project *types.Project, opti
91
93
}}
92
94
}
93
95
opts [imageName ] = buildOptions
94
- }
95
-
96
- _ , err = s .doBuild (ctx , project , opts , options .Progress )
97
- return err
96
+ _ , err = s .doBuild (ctx , project , opts , options .Progress )
97
+ return err
98
+ }, func (traversal * graphTraversal ) {
99
+ traversal .maxConcurrency = s .maxConcurrency
100
+ })
98
101
}
99
102
100
103
func (s * composeService ) ensureImagesExists (ctx context.Context , project * types.Project , quietPull bool ) error {
0 commit comments