Skip to content

Commit 213c03f

Browse files
ndeloofglours
authored andcommitted
produce bake targets for all services, group for services to build
Signed-off-by: Nicolas De Loof <[email protected]>
1 parent ebd7b76 commit 213c03f

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

pkg/compose/build_bake.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ func (s *composeService) doBuildBake(ctx context.Context, project *types.Project
148148
)
149149

150150
// produce a unique ID for service used as bake target
151-
for serviceName := range serviceToBeBuild {
151+
for serviceName := range project.Services {
152152
t := strings.ReplaceAll(serviceName, ".", "_")
153153
for {
154154
if _, ok := targets[serviceName]; !ok {
@@ -159,7 +159,7 @@ func (s *composeService) doBuildBake(ctx context.Context, project *types.Project
159159
}
160160
}
161161

162-
for serviceName, service := range serviceToBeBuild {
162+
for serviceName, service := range project.Services {
163163
if service.Build == nil {
164164
continue
165165
}
@@ -230,7 +230,14 @@ func (s *composeService) doBuildBake(ctx context.Context, project *types.Project
230230
Outputs: outputs,
231231
Call: call,
232232
}
233-
group.Targets = append(group.Targets, target)
233+
}
234+
235+
// create a bake group with targets for services to build
236+
for serviceName, service := range serviceToBeBuild {
237+
if service.Build == nil {
238+
continue
239+
}
240+
group.Targets = append(group.Targets, targets[serviceName])
234241
}
235242

236243
cfg.Groups["default"] = group

0 commit comments

Comments
 (0)