Merge pull request #53 from tonistiigi/compose-target

bake: fix parsing target from compose files
pull/56/head
Tõnis Tiigi 6 years ago committed by GitHub
commit 4c84819a32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -53,7 +53,8 @@ func ParseCompose(dt []byte) (*Config, error) {
// TODO: add platforms // TODO: add platforms
} }
if s.Build.Target != "" { if s.Build.Target != "" {
t.Target = &s.Build.Target target := s.Build.Target
t.Target = &target
} }
if s.Image != "" { if s.Image != "" {
t.Tags = []string{s.Image} t.Tags = []string{s.Image}

@ -39,3 +39,23 @@ services:
require.Equal(t, 1, len(c.Target["webapp"].Args)) require.Equal(t, 1, len(c.Target["webapp"].Args))
require.Equal(t, "123", c.Target["webapp"].Args["buildno"]) require.Equal(t, "123", c.Target["webapp"].Args["buildno"])
} }
func TestParseComposeTarget(t *testing.T) {
var dt = []byte(`
version: "3.7"
services:
db:
build:
target: db
webapp:
build:
target: webapp
`)
c, err := ParseCompose(dt)
require.NoError(t, err)
require.Equal(t, "db", *c.Target["db"].Target)
require.Equal(t, "webapp", *c.Target["webapp"].Target)
}

Loading…
Cancel
Save