github.com/google/osv-scalibr@v0.4.1/artifact/image/testfixtures/symlink-depth-exceeded/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 dir2/dir3
     8  
     9  RUN echo "sample text" > dir1/sample.txt
    10  
    11  RUN ln -s /dir1/sample.txt /dir1/symlink1.txt
    12  RUN ln -s /dir1/symlink1.txt /dir1/symlink2.txt
    13  RUN ln -s /dir1/symlink2.txt /dir1/symlink3.txt
    14  RUN ln -s /dir1/symlink3.txt /dir1/symlink4.txt
    15  RUN ln -s /dir1/symlink4.txt /dir1/symlink5.txt
    16  RUN ln -s /dir1/symlink5.txt /dir1/symlink6.txt
    17  RUN ln -s /dir1/symlink6.txt /dir1/symlink7.txt
    18  
    19  # - root
    20  #   - dir1
    21  #     - sample.txt
    22  #     - symlink1.txt -> /dir1/sample.txt
    23  #     - symlink2.txt -> /dir1/symlink1.txt
    24  #     - symlink3.txt -> /dir1/symlink2.txt
    25  #     - symlink4.txt -> /dir1/symlink3.txt
    26  #     - symlink5.txt -> /dir1/symlink4.txt
    27  #     - symlink6.txt -> /dir1/symlink5.txt
    28  #     - symlink7.txt -> /dir1/symlink6.txt
    29  
    30  FROM scratch
    31  
    32  # Must copy over the entire directory to preserve the symlinks.
    33  COPY --from=builder /dir1/ /dir1/