mirror of
https://github.com/docker/compose.git
synced 2025-07-26 07:04:32 +02:00
fix exporter to only load image for default platform
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
cde9ae5952
commit
8d68ef587f
@ -173,10 +173,14 @@ func (s *composeService) doBuildBake(ctx context.Context, project *types.Project
|
|||||||
privileged = true
|
privileged = true
|
||||||
}
|
}
|
||||||
|
|
||||||
outputs := []string{"type=docker"}
|
var output string
|
||||||
if options.Push && service.Image != "" {
|
push := options.Push && service.Image != ""
|
||||||
outputs = append(outputs, "type=image,push=true")
|
if len(service.Build.Platforms) > 1 {
|
||||||
|
output = fmt.Sprintf("type=image,push=%t", push)
|
||||||
|
} else {
|
||||||
|
output = fmt.Sprintf("type=docker,load=true,push=%t", push)
|
||||||
}
|
}
|
||||||
|
|
||||||
read = append(read, build.Context)
|
read = append(read, build.Context)
|
||||||
for _, path := range build.AdditionalContexts {
|
for _, path := range build.AdditionalContexts {
|
||||||
_, err := gitutil.ParseGitRef(path)
|
_, err := gitutil.ParseGitRef(path)
|
||||||
@ -205,7 +209,7 @@ func (s *composeService) doBuildBake(ctx context.Context, project *types.Project
|
|||||||
ShmSize: build.ShmSize,
|
ShmSize: build.ShmSize,
|
||||||
Ulimits: toBakeUlimits(build.Ulimits),
|
Ulimits: toBakeUlimits(build.Ulimits),
|
||||||
Entitlements: entitlements,
|
Entitlements: entitlements,
|
||||||
Outputs: outputs,
|
Outputs: []string{output},
|
||||||
}
|
}
|
||||||
group.Targets = append(group.Targets, serviceName)
|
group.Targets = append(group.Targets, serviceName)
|
||||||
}
|
}
|
||||||
|
@ -305,7 +305,7 @@ func TestBuildPlatformsWithCorrectBuildxConfig(t *testing.T) {
|
|||||||
"-f", "fixtures/build-test/platforms/compose-unsupported-platform.yml", "build")
|
"-f", "fixtures/build-test/platforms/compose-unsupported-platform.yml", "build")
|
||||||
res.Assert(t, icmd.Expected{
|
res.Assert(t, icmd.Expected{
|
||||||
ExitCode: 1,
|
ExitCode: 1,
|
||||||
Err: "no match for platform in",
|
Err: "no match for platform",
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user