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