@@ -142,6 +142,8 @@ var allTests = integration.TestFuncs(
142
142
testNamedMultiplatformInputContext ,
143
143
testNamedFilteredContext ,
144
144
testEmptyDestDir ,
145
+ testCopyLinkDotDestDir ,
146
+ testCopyLinkEmptyDestDir ,
145
147
testCopyChownCreateDest ,
146
148
testCopyThroughSymlinkContext ,
147
149
testCopyThroughSymlinkMultiStage ,
@@ -447,6 +449,67 @@ RUN [ "$(cat testfile)" == "contents0" ]
447
449
require .NoError (t , err )
448
450
}
449
451
452
+ func testCopyLinkDotDestDir (t * testing.T , sb integration.Sandbox ) {
453
+ integration .SkipOnPlatform (t , "windows" )
454
+ f := getFrontend (t , sb )
455
+
456
+ dockerfile := []byte (`
457
+ FROM busybox
458
+ WORKDIR /var/www
459
+ COPY --link testfile .
460
+ RUN [ "$(cat testfile)" == "contents0" ]
461
+ ` )
462
+
463
+ dir := integration .Tmpdir (
464
+ t ,
465
+ fstest .CreateFile ("Dockerfile" , dockerfile , 0600 ),
466
+ fstest .CreateFile ("testfile" , []byte ("contents0" ), 0600 ),
467
+ )
468
+
469
+ c , err := client .New (sb .Context (), sb .Address ())
470
+ require .NoError (t , err )
471
+ defer c .Close ()
472
+
473
+ _ , err = f .Solve (sb .Context (), c , client.SolveOpt {
474
+ LocalMounts : map [string ]fsutil.FS {
475
+ dockerui .DefaultLocalNameDockerfile : dir ,
476
+ dockerui .DefaultLocalNameContext : dir ,
477
+ },
478
+ }, nil )
479
+ require .NoError (t , err )
480
+ }
481
+
482
+ func testCopyLinkEmptyDestDir (t * testing.T , sb integration.Sandbox ) {
483
+ integration .SkipOnPlatform (t , "windows" )
484
+ f := getFrontend (t , sb )
485
+
486
+ dockerfile := []byte (`
487
+ FROM busybox
488
+ WORKDIR /var/www
489
+ ENV empty=""
490
+ COPY --link testfile $empty
491
+ RUN [ "$(cat testfile)" == "contents0" ]
492
+ ` )
493
+
494
+ dir := integration .Tmpdir (
495
+ t ,
496
+ fstest .CreateFile ("Dockerfile" , dockerfile , 0600 ),
497
+ fstest .CreateFile ("testfile" , []byte ("contents0" ), 0600 ),
498
+ )
499
+
500
+ c , err := client .New (sb .Context (), sb .Address ())
501
+ require .NoError (t , err )
502
+ defer c .Close ()
503
+
504
+ _ , err = f .Solve (sb .Context (), c , client.SolveOpt {
505
+ LocalMounts : map [string ]fsutil.FS {
506
+ dockerui .DefaultLocalNameDockerfile : dir ,
507
+ dockerui .DefaultLocalNameContext : dir ,
508
+ },
509
+ }, nil )
510
+ require .NoError (t , err )
511
+ }
512
+
450
513
func testExportCacheLoop (t * testing.T , sb integration.Sandbox ) {
451
514
integration .SkipOnPlatform (t , "windows" )
452
515
workers .CheckFeatureCompat (t , sb , workers .FeatureCacheExport , workers .FeatureCacheImport , workers .FeatureCacheBackendLocal )
0 commit comments