mirror of
https://github.com/drwetter/testssl.sh.git
synced 2025-09-02 18:18:29 +02:00
Merge pull request #2752 from polarathene/patch-1
refactor: Docker (Alpine) improvements
This commit is contained in:
@ -1,24 +1,22 @@
|
|||||||
# Build using git repo
|
FROM alpine:3.21 AS base-alpine
|
||||||
|
RUN apk add --no-cache bash procps drill coreutils libidn curl socat openssl xxd \
|
||||||
FROM alpine:3.20
|
|
||||||
|
|
||||||
WORKDIR /home/testssl
|
|
||||||
|
|
||||||
ARG BUILD_VERSION
|
|
||||||
ARG ARCHIVE_URL=https://github.com/testssl/testssl.sh/archive/
|
|
||||||
ARG URL=https://github.com/testssl/testssl.sh.git
|
|
||||||
|
|
||||||
RUN test -n "${BUILD_VERSION}" \
|
|
||||||
&& apk update \
|
|
||||||
&& apk add --no-cache bash procps drill git coreutils libidn curl socat openssl xxd \
|
|
||||||
&& git clone --depth 1 --branch ${BUILD_VERSION} $URL /home/testssl \
|
|
||||||
&& addgroup testssl \
|
&& addgroup testssl \
|
||||||
&& adduser -G testssl -g "testssl user" -s /bin/bash -D testssl \
|
&& adduser -G testssl -g "testssl user" -s /bin/bash -D testssl \
|
||||||
&& ln -s /home/testssl/testssl.sh /usr/local/bin/ \
|
&& ln -s /home/testssl/testssl.sh /usr/local/bin/testssl.sh
|
||||||
&& mkdir -m 755 -p /home/testssl/etc /home/testssl/bin
|
|
||||||
|
|
||||||
USER testssl
|
USER testssl
|
||||||
|
|
||||||
ENTRYPOINT ["testssl.sh"]
|
ENTRYPOINT ["testssl.sh"]
|
||||||
|
|
||||||
CMD ["--help"]
|
CMD ["--help"]
|
||||||
|
|
||||||
|
# Final image stage (add testssl.sh project files)
|
||||||
|
# Choose either one as the final stage (defaults to last stage, `dist-git`)
|
||||||
|
|
||||||
|
# 30MB Image (Local repo copy from build context, uses `.dockerignore`):
|
||||||
|
FROM base-alpine AS dist-local
|
||||||
|
COPY --chown=testssl:testssl . /home/testssl/
|
||||||
|
|
||||||
|
# 38MB Image (Remote repo clone, cannot filter content through `.dockerignore`):
|
||||||
|
FROM base-alpine AS dist-git
|
||||||
|
ARG GIT_URL=https://github.com/testssl/testssl.sh.git
|
||||||
|
ARG GIT_BRANCH
|
||||||
|
ADD --chown=testssl:testssl ${GIT_URL}#${GIT_BRANCH?branch-required} /home/testssl
|
||||||
|
Reference in New Issue
Block a user