mirror of
https://github.com/docker/compose.git
synced 2025-04-08 17:05:13 +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
|
||||
}
|
||||
|
||||
outputs := []string{"type=docker"}
|
||||
if options.Push && service.Image != "" {
|
||||
outputs = append(outputs, "type=image,push=true")
|
||||
var output string
|
||||
push := options.Push && service.Image != ""
|
||||
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)
|
||||
for _, path := range build.AdditionalContexts {
|
||||
_, err := gitutil.ParseGitRef(path)
|
||||
@ -205,7 +209,7 @@ func (s *composeService) doBuildBake(ctx context.Context, project *types.Project
|
||||
ShmSize: build.ShmSize,
|
||||
Ulimits: toBakeUlimits(build.Ulimits),
|
||||
Entitlements: entitlements,
|
||||
Outputs: outputs,
|
||||
Outputs: []string{output},
|
||||
}
|
||||
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")
|
||||
res.Assert(t, icmd.Expected{
|
||||
ExitCode: 1,
|
||||
Err: "no match for platform in",
|
||||
Err: "no match for platform",
|
||||
})
|
||||
})
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user