chore: Dockerfile - Adopt HereDoc syntax

This commit is contained in:
Brennan Kinney
2025-05-19 11:47:15 +12:00
committed by GitHub
parent 0d0c5d0ab9
commit 5b899958ec
2 changed files with 53 additions and 30 deletions

View File

@ -1,8 +1,20 @@
# syntax=docker.io/docker/dockerfile:1
FROM alpine:3.21 AS base-alpine
RUN apk add --no-cache bash procps drill coreutils libidn curl socat openssl xxd \
&& addgroup testssl \
&& adduser -G testssl -g "testssl user" -s /bin/bash -D testssl \
&& ln -s /home/testssl/testssl.sh /usr/local/bin/testssl.sh
RUN <<HEREDOC
apk add --no-cache bash procps drill coreutils libidn curl socat openssl xxd
# Add a non-root user `testssl`, this is roughly equivalent to the `adduser` command:
# addgroup testssl && adduser -G testssl -g "testssl user" -s /bin/bash -D testssl
echo 'testssl:x:1000:1000::/home/testssl:/bin/bash' >> /etc/passwd
echo 'testssl:x:1000:' >> /etc/group
echo 'testssl:!::0:::::' >> /etc/shadow
install --mode 2755 --owner testssl --group testssl --directory /home/testssl
# A copy of `testssl.sh` will be added to the home directory,
# symlink to that file so it can be treated as a command:
ln -s /home/testssl/testssl.sh /usr/local/bin/testssl.sh
HEREDOC
# Runtime config:
USER testssl
@ -10,7 +22,7 @@ ENTRYPOINT ["testssl.sh"]
CMD ["--help"]
# Final image stage (add `testssl.sh` project files)
# Choose either one as the final stage (defaults to last stage, `dist-git`)
# Choose either one as the final stage (defaults to the last stage, `dist-local`)
# 35MB Image (Remote repo clone, cannot filter content through `.dockerignore`):
FROM base-alpine AS dist-git