@@ -472,6 +472,111 @@ extension TestCLIBuildBase {
472472 #expect( try self . inspectImage ( imageName) == imageName, " expected to have successfully built \( imageName) " )
473473 }
474474
475+ @Test func testLowercaseDockerfile( ) throws {
476+ // Test 1: COPY with uppercase
477+ let tempDir1 : URL = try createTempDir ( )
478+ let dockerfile1 =
479+ """
480+ FROM ghcr.io/linuxcontainers/alpine:3.20
481+ COPY . /app
482+ RUN test -f /app/testfile.txt
483+ """
484+ let context1 : [ FileSystemEntry ] = [
485+ . file( " testfile.txt " , content: . data( " test " . data ( using: . utf8) !) )
486+ ]
487+ try createContext ( tempDir: tempDir1, dockerfile: dockerfile1, context: context1)
488+ let imageName1 = " registry.local/copy-uppercase: \( UUID ( ) . uuidString) "
489+ try self . build ( tag: imageName1, tempDir: tempDir1)
490+ #expect( try self . inspectImage ( imageName1) == imageName1, " expected COPY to work " )
491+
492+ // Test 2: copy with lowercase
493+ let tempDir2 : URL = try createTempDir ( )
494+ let dockerfile2 =
495+ """
496+ FROM ghcr.io/linuxcontainers/alpine:3.20
497+ copy . /app
498+ RUN test -f /app/testfile.txt
499+ """
500+ let context2 : [ FileSystemEntry ] = [
501+ . file( " testfile.txt " , content: . data( " test " . data ( using: . utf8) !) )
502+ ]
503+ try createContext ( tempDir: tempDir2, dockerfile: dockerfile2, context: context2)
504+ let imageName2 = " registry.local/copy-lowercase: \( UUID ( ) . uuidString) "
505+ try self . build ( tag: imageName2, tempDir: tempDir2)
506+ #expect( try self . inspectImage ( imageName2) == imageName2, " expected copy to work " )
507+
508+ // Test 3: ADD with uppercase
509+ let tempDir3 : URL = try createTempDir ( )
510+ let dockerfile3 =
511+ """
512+ FROM ghcr.io/linuxcontainers/alpine:3.20
513+ ADD . /app
514+ RUN test -f /app/testfile.txt
515+ """
516+ let context3 : [ FileSystemEntry ] = [
517+ . file( " testfile.txt " , content: . data( " test " . data ( using: . utf8) !) )
518+ ]
519+ try createContext ( tempDir: tempDir3, dockerfile: dockerfile3, context: context3)
520+ let imageName3 = " registry.local/add-uppercase: \( UUID ( ) . uuidString) "
521+ try self . build ( tag: imageName3, tempDir: tempDir3)
522+ #expect( try self . inspectImage ( imageName3) == imageName3, " expected ADD to work " )
523+
524+ // Test 4: add with lowercase
525+ let tempDir4 : URL = try createTempDir ( )
526+ let dockerfile4 =
527+ """
528+ FROM ghcr.io/linuxcontainers/alpine:3.20
529+ add . /app
530+ RUN test -f /app/testfile.txt
531+ """
532+ let context4 : [ FileSystemEntry ] = [
533+ . file( " testfile.txt " , content: . data( " test " . data ( using: . utf8) !) )
534+ ]
535+ try createContext ( tempDir: tempDir4, dockerfile: dockerfile4, context: context4)
536+ let imageName4 = " registry.local/add-lowercase: \( UUID ( ) . uuidString) "
537+ try self . build ( tag: imageName4, tempDir: tempDir4)
538+ #expect( try self . inspectImage ( imageName4) == imageName4, " expected add to work " )
539+ }
540+
541+ @Test func testRunWithBindMount( ) throws {
542+ let tempDir : URL = try createTempDir ( )
543+ let dockerfile =
544+ """
545+ FROM ghcr.io/linuxcontainers/alpine:3.20
546+
547+ # Use bind mount to access build context during RUN
548+ RUN --mount=type=bind,source=.,target=/mnt/context \
549+ set -e; \
550+ echo " Checking files in bind mount... " ; \
551+ ls -la /mnt/context/; \
552+ \
553+ echo " Verifying files are accessible in mount... " ; \
554+ if [ ! -f /mnt/context/app.py ]; then \
555+ echo " ERROR: app.py should be in bind mount! " ; \
556+ exit 1; \
557+ fi; \
558+ if [ ! -f /mnt/context/config.yaml ]; then \
559+ echo " ERROR: config.yaml should be in bind mount! " ; \
560+ exit 1; \
561+ fi; \
562+ \
563+ echo " RUN --mount bind check passed! " ; \
564+ cp /mnt/context/app.py /app.py
565+
566+ RUN cat /app.py
567+ """
568+
569+ let context : [ FileSystemEntry ] = [
570+ . file( " app.py " , content: . data( " print('Hello from bind mount') " . data ( using: . utf8) !) ) ,
571+ . file( " config.yaml " , content: . data( " key: value " . data ( using: . utf8) !) ) ,
572+ ]
573+
574+ try createContext ( tempDir: tempDir, dockerfile: dockerfile, context: context)
575+ let imageName = " registry.local/bind-mount-test: \( UUID ( ) . uuidString) "
576+ try self . build ( tag: imageName, tempDir: tempDir)
577+ #expect( try self . inspectImage ( imageName) == imageName, " expected to have successfully built \( imageName) " )
578+ }
579+
475580 @Test func testBuildDockerIgnore( ) throws {
476581 let tempDir : URL = try createTempDir ( )
477582 let dockerfile =
0 commit comments