add default compose labels to images built from bake

Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
This commit is contained in:
Guillaume Lours 2025-07-15 23:09:59 +02:00 committed by Nicolas De loof
parent 29308cb97e
commit 5e147e852e

View File

@ -164,6 +164,7 @@ func (s *composeService) doBuildBake(ctx context.Context, project *types.Project
continue
}
build := *service.Build
labels := getImageBuildLabels(project, service)
args := types.Mapping{}
for k, v := range resolveAndMergeBuildArgs(s.dockerCli, project, service, options) {
@ -209,7 +210,7 @@ func (s *composeService) doBuildBake(ctx context.Context, project *types.Project
Dockerfile: dockerFilePath(build.Context, build.Dockerfile),
DockerfileInline: strings.ReplaceAll(build.DockerfileInline, "${", "$${"),
Args: args,
Labels: build.Labels,
Labels: labels,
Tags: append(build.Tags, api.GetImageNameOrDefault(service, project.Name)),
CacheFrom: build.CacheFrom,