github.com/google/osv-scalibr@v0.4.1/artifact/image/testfixtures/symlink-basic/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  
     7  RUN echo "sample text" > dir1/sample.txt
     8  
     9  RUN ln -s /dir1/sample.txt /dir1/absolute-symlink.txt
    10  RUN ln -s ./sample.txt /dir1/relative-dot-symlink.txt
    11  RUN ln -s sample.txt /dir1/relative-symlink.txt
    12  RUN ln -s absolute-symlink.txt /dir1/chain-symlink.txt
    13  
    14  # - root
    15  #   - dir1
    16  #     - sample.txt
    17  #     - absolute-symlink.txt -> /dir1/sample.txt
    18  #     - relative-dot-symlink.txt -> ./sample.txt
    19  #     - relative-symlink.txt -> sample.txt
    20  
    21  FROM scratch
    22  
    23  # Must copy over the entire directory to preserve the symlinks.
    24  COPY --from=builder /dir1/ /dir1/