diff --git a/frontend/dockerfile/dockerfile2llb/convert.go b/frontend/dockerfile/dockerfile2llb/convert.go index 07cd106a..f32316b2 100644 --- a/frontend/dockerfile/dockerfile2llb/convert.go +++ b/frontend/dockerfile/dockerfile2llb/convert.go @@ -35,7 +35,7 @@ const ( localNameContext = "context" historyComment = "buildkit.dockerfile.v0" - DefaultCopyImage = "tonistiigi/copy:v0.1.4@sha256:d9d49bedbbe2b27df88115e6aff7b9cd11ed2fbd8d9013f02d3da735c08c92e5" + DefaultCopyImage = "tonistiigi/copy:v0.1.5@sha256:eab89b76ffbb3c807663a67a41e8be31b8a0e362d7fb074a55bddace563a28bb" ) type ConvertOpt struct { diff --git a/frontend/dockerfile/dockerfile_test.go b/frontend/dockerfile/dockerfile_test.go index 46136c33..36a056a2 100644 --- a/frontend/dockerfile/dockerfile_test.go +++ b/frontend/dockerfile/dockerfile_test.go @@ -51,7 +51,7 @@ func init() { opts = []integration.TestOpt{ integration.WithMirroredImages(integration.OfficialImages("busybox:latest")), integration.WithMirroredImages(map[string]string{ - "tonistiigi/copy:v0.1.4": "docker.io/" + dockerfile2llb.DefaultCopyImage, + "tonistiigi/copy:v0.1.5": "docker.io/" + dockerfile2llb.DefaultCopyImage, }), integration.WithMatrix("frontend", frontends), } @@ -114,9 +114,40 @@ func TestIntegration(t *testing.T) { testIgnoreEntrypoint, testCopyThroughSymlinkContext, testCopyThroughSymlinkMultiStage, + testCopyChownCreateDest, }, opts...) } +func testCopyChownCreateDest(t *testing.T, sb integration.Sandbox) { + t.Parallel() + f := getFrontend(t, sb) + + dockerfile := []byte(` +FROM busybox +RUN adduser -D user +COPY --chown=user:user . /dest +RUN [ "$(stat -c "%U %G" /dest)" == "user user" ] +`) + + dir, err := tmpdir( + fstest.CreateFile("Dockerfile", dockerfile, 0600), + ) + require.NoError(t, err) + defer os.RemoveAll(dir) + + c, err := client.New(context.TODO(), sb.Address()) + require.NoError(t, err) + defer c.Close() + + _, err = f.Solve(context.TODO(), c, client.SolveOpt{ + LocalDirs: map[string]string{ + builder.LocalNameDockerfile: dir, + builder.LocalNameContext: dir, + }, + }, nil) + require.NoError(t, err) +} + func testCopyThroughSymlinkContext(t *testing.T, sb integration.Sandbox) { t.Parallel() f := getFrontend(t, sb)