Skip to content

Commit 57b17f0

Browse files
committed
fix run --build support for service:* reference in additional_context
Signed-off-by: Nicolas De Loof <[email protected]>
1 parent 6078b4d commit 57b17f0

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

pkg/e2e/build_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import (
3232
)
3333

3434
func TestLocalComposeBuild(t *testing.T) {
35-
for _, env := range []string{"DOCKER_BUILDKIT=0", "DOCKER_BUILDKIT=1", "DOCKER_BUILDKIT=1,COMPOSE-BAKE=1"} {
35+
for _, env := range []string{"DOCKER_BUILDKIT=0", "DOCKER_BUILDKIT=1,COMPOSE-BAKE=0", "DOCKER_BUILDKIT=1,COMPOSE-BAKE=1"} {
3636
c := NewCLI(t, WithEnv(strings.Split(env, ",")...))
3737

3838
t.Run(env+" build named and unnamed images", func(t *testing.T) {

pkg/e2e/compose_run_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,4 +216,10 @@ func TestLocalComposeRun(t *testing.T) {
216216
"front", "env")
217217
res.Assert(t, icmd.Expected{Out: "FOO=BAR"})
218218
})
219+
220+
t.Run("compose run --build", func(t *testing.T) {
221+
c.cleanupWithDown(t, "run-test", "--rmi=local")
222+
res := c.RunDockerComposeCmd(t, "-f", "./fixtures/run-test/compose.yaml", "run", "build", "echo", "hello world")
223+
res.Assert(t, icmd.Expected{Out: "hello world"})
224+
})
219225
}

pkg/e2e/fixtures/run-test/compose.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ services:
1616
image: nginx:alpine
1717
networks:
1818
- frontnet
19+
build:
20+
build:
21+
dockerfile_inline: "FROM base"
22+
additional_contexts:
23+
base: "service:build_base"
24+
build_base:
25+
build:
26+
dockerfile_inline: "FROM alpine"
1927
networks:
2028
frontnet:
2129
backnet:

0 commit comments

Comments
 (0)