github.com/google/osv-scalibr@v0.4.1/artifact/image/testfixtures/symlinks-across-layers/Dockerfile (about)

     1  # Use Alpine as the builder since the final image is built on scratch
     2  # which doesn't contain the `ln` command to generate symlinks.
     3  FROM alpine:latest as builder
     4  
     5  RUN mkdir dir1
     6  RUN mkdir dir2
     7  RUN mkdir
     8  
     9  
    10  RUN echo "sample text" > dir1/sample.txt
    11  RUN ln -s /dir1/sample.txt /dir2/absolute-symlink.txt
    12  RUN ln -s /dir2/absolute-symlink.txt /dir3/chain-symlink.txt
    13  
    14  
    15  # - root
    16  #   - dir1
    17  #     - sample.txt
    18  #   - dir2
    19  #     - absolute-symlink.txt -> /dir1/sample.txt
    20  #   - dir3
    21  #     - chain-symlink.txt -> /dir2absolute-symlink.txt
    22  FROM scratch
    23  
    24  # Must copy over the entire directory to preserve the symlinks.
    25  COPY --from=builder /dir3/ /dir3/
    26  COPY --from=builder /dir2/ /dir2/
    27  COPY --from=builder /dir1/ /dir1/