@@ -3466,9 +3466,13 @@ COPY --chmod=0644 foo /
3466
3466
COPY --chmod=777 bar /baz
3467
3467
COPY --chmod=0 foo /foobis
3468
3468
3469
+ ARG mode
3470
+ COPY --chmod=${mode} foo /footer
3471
+
3469
3472
RUN stat -c "%04a" /foo > /out/fooperm
3470
3473
RUN stat -c "%04a" /baz > /out/barperm
3471
3474
RUN stat -c "%04a" /foobis > /out/foobisperm
3475
+ RUN stat -c "%04a" /footer > /out/footerperm
3472
3476
FROM scratch
3473
3477
COPY --from=base /out /
3474
3478
` )
@@ -3493,6 +3497,9 @@ COPY --from=base /out /
3493
3497
OutputDir : destDir ,
3494
3498
},
3495
3499
},
3500
+ FrontendAttrs : map [string ]string {
3501
+ "build-arg:mode" : "755" ,
3502
+ },
3496
3503
LocalMounts : map [string ]fsutil.FS {
3497
3504
dockerui .DefaultLocalNameDockerfile : dir ,
3498
3505
dockerui .DefaultLocalNameContext : dir ,
@@ -3512,6 +3519,10 @@ COPY --from=base /out /
3512
3519
dt , err = os .ReadFile (filepath .Join (destDir , "foobisperm" ))
3513
3520
require .NoError (t , err )
3514
3521
require .Equal (t , "0000\n " , string (dt ))
3522
+
3523
+ dt , err = os .ReadFile (filepath .Join (destDir , "footerperm" ))
3524
+ require .NoError (t , err )
3525
+ require .Equal (t , "0755\n " , string (dt ))
3515
3526
}
3516
3527
3517
3528
func testCopyOverrideFiles (t * testing.T , sb integration.Sandbox ) {
@@ -3763,9 +3774,14 @@ FROM busybox AS build
3763
3774
ADD --chmod=644 %[1]s /tmp/foo1
3764
3775
ADD --chmod=755 %[1]s /tmp/foo2
3765
3776
ADD --chmod=0413 %[1]s /tmp/foo3
3777
+
3778
+ ARG mode
3779
+ ADD --chmod=${mode} %[1]s /tmp/foo4
3780
+
3766
3781
RUN stat -c "%%04a" /tmp/foo1 >> /dest && \
3767
3782
stat -c "%%04a" /tmp/foo2 >> /dest && \
3768
- stat -c "%%04a" /tmp/foo3 >> /dest
3783
+ stat -c "%%04a" /tmp/foo3 >> /dest && \
3784
+ stat -c "%%04a" /tmp/foo4 >> /dest
3769
3785
3770
3786
FROM scratch
3771
3787
COPY --from=build /dest /dest
@@ -3789,6 +3805,9 @@ COPY --from=build /dest /dest
3789
3805
OutputDir : destDir ,
3790
3806
},
3791
3807
},
3808
+ FrontendAttrs : map [string ]string {
3809
+ "build-arg:mode" : "400" ,
3810
+ },
3792
3811
LocalMounts : map [string ]fsutil.FS {
3793
3812
dockerui .DefaultLocalNameDockerfile : dir ,
3794
3813
dockerui .DefaultLocalNameContext : dir ,
@@ -3798,7 +3817,7 @@ COPY --from=build /dest /dest
3798
3817
3799
3818
dt , err := os .ReadFile (filepath .Join (destDir , "dest" ))
3800
3819
require .NoError (t , err )
3801
- require .Equal (t , []byte ("0644\n 0755\n 0413\n " ), dt )
3820
+ require .Equal (t , []byte ("0644\n 0755\n 0413\n 0400 \ n " ), dt )
3802
3821
}
3803
3822
3804
3823
func testDockerfileFromGit (t * testing.T , sb integration.Sandbox ) {
0 commit comments