produce bake targets for all services, group for services to build

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
Nicolas De Loof 2025-06-10 08:32:06 +02:00 committed by Guillaume Lours
parent ebd7b761f2
commit 213c03f99a

View File

@ -148,7 +148,7 @@ func (s *composeService) doBuildBake(ctx context.Context, project *types.Project
)
// produce a unique ID for service used as bake target
for serviceName := range serviceToBeBuild {
for serviceName := range project.Services {
t := strings.ReplaceAll(serviceName, ".", "_")
for {
if _, ok := targets[serviceName]; !ok {
@ -159,7 +159,7 @@ func (s *composeService) doBuildBake(ctx context.Context, project *types.Project
}
}
for serviceName, service := range serviceToBeBuild {
for serviceName, service := range project.Services {
if service.Build == nil {
continue
}
@ -230,7 +230,14 @@ func (s *composeService) doBuildBake(ctx context.Context, project *types.Project
Outputs: outputs,
Call: call,
}
group.Targets = append(group.Targets, target)
}
// create a bake group with targets for services to build
for serviceName, service := range serviceToBeBuild {
if service.Build == nil {
continue
}
group.Targets = append(group.Targets, targets[serviceName])
}
cfg.Groups["default"] = group