Skip to content

Commit b0156cd

Browse files
authored
Merge pull request #3090 from tonistiigi/platforms-compose
bake: fix platforms field in compose yaml
2 parents 8f9c25e + 49bd7e4 commit b0156cd

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

bake/compose.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ func ParseCompose(cfgs []composetypes.ConfigFile, envs map[string]string) (*Conf
177177
CacheFrom: cacheFrom,
178178
CacheTo: cacheTo,
179179
NetworkMode: networkModeP,
180+
Platforms: s.Build.Platforms,
180181
SSH: ssh,
181182
Secrets: secrets,
182183
ShmSize: shmSize,

bake/compose_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,21 @@ services:
463463
require.NoError(t, err)
464464
}
465465

466+
func TestPlatforms(t *testing.T) {
467+
dt := []byte(`
468+
services:
469+
foo:
470+
build:
471+
context: .
472+
platforms:
473+
- linux/amd64
474+
- linux/arm64
475+
`)
476+
c, err := ParseCompose([]composetypes.ConfigFile{{Content: dt}}, nil)
477+
require.NoError(t, err)
478+
require.Equal(t, []string{"linux/amd64", "linux/arm64"}, c.Targets[0].Platforms)
479+
}
480+
466481
func newBool(val bool) *bool {
467482
b := val
468483
return &b

0 commit comments

Comments
 (0)