github.com/google/osv-scalibr@v0.4.1/artifact/image/testfixtures/dangling-symlinks/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 # 4 # This dockerfile does not create the file, sample.txt in order to test for 5 # dangling symlinks. 6 FROM alpine:latest as builder 7 8 RUN mkdir dir1 9 RUN mkdir dir2 10 RUN mkdir dir2/dir3 11 12 RUN ln -s /dir1/sample.txt /dir1/absolute-symlink.txt 13 RUN ln -s ./sample.txt /dir1/relative-dot-symlink.txt 14 RUN ln -s sample.txt /dir1/relative-symlink.txt 15 RUN ln -s absolute-symlink.txt /dir1/chain-symlink.txt 16 17 RUN ln -s ../../dir1/sample.txt /dir2/dir3/relative-subfolder-symlink.txt 18 RUN ln -s /dir1/sample.txt /dir2/dir3/absolute-subfolder-symlink.txt 19 RUN ln -s /dir1/chain-symlink.txt /dir2/dir3/absolute-chain-symlink.txt 20 21 # - root 22 # - dir1 23 # - absolute-symlink.txt -> /dir1/sample.txt 24 # - relative-dot-symlink.txt -> ./sample.txt 25 # - relative-symlink.txt -> sample.txt 26 # - chain-symlink.txt -> absolute-symlink.txt 27 # - dir2 28 # - dir3 29 # - relative-subfolder-symlink.txt -> ../../dir1/sample.txt 30 # - absolute-subfolder-symlink.txt -> /dir1/sample.txt 31 # - absolute-chain-symlink.txt -> /dir1/chain-symlink.txt 32 33 FROM scratch 34 35 # Must copy over the entire directory to preserve the symlinks. 36 COPY --from=builder /dir1/ /dir1/ 37 COPY --from=builder /dir2/ /dir2/