2023-03-22 09:18:36 +01:00
|
|
|
# syntax=docker.io/docker/dockerfile:1
|
2023-03-22 09:31:34 +01:00
|
|
|
|
2024-10-14 17:51:24 +02:00
|
|
|
ARG LEAP_VERSION=15.6
|
2023-03-22 09:18:36 +01:00
|
|
|
ARG INSTALL_ROOT=/rootfs
|
2017-03-30 13:18:46 +02:00
|
|
|
|
2023-03-22 09:18:36 +01:00
|
|
|
FROM opensuse/leap:${LEAP_VERSION} as builder
|
2023-03-22 09:31:34 +01:00
|
|
|
ARG CACHE_ZYPPER=/tmp/cache/zypper
|
2023-03-22 09:18:36 +01:00
|
|
|
ARG INSTALL_ROOT
|
2023-10-13 17:07:38 +02:00
|
|
|
|
|
|
|
|
|
|
|
# /etc/os-release provides $VERSION_ID below.
|
|
|
|
# We don't need the openh264.repo and the non-oss repos, just costs build time (repo caches).
|
|
|
|
# Also we need to remove the util_linux RPM to /really/ make sure busybox-util-linux gets installed.
|
2023-10-13 17:32:35 +02:00
|
|
|
# And we need to run zypper update, see all PR #2424.
|
2023-03-22 10:56:59 +01:00
|
|
|
RUN source /etc/os-release \
|
2023-10-13 17:07:38 +02:00
|
|
|
&& rm -f /etc/zypp/repos.d/repo-openh264.repo /etc/zypp/repos.d/repo-non-oss.repo \
|
2023-03-22 10:56:59 +01:00
|
|
|
&& export ZYPPER_OPTIONS=( --releasever "${VERSION_ID}" --installroot "${INSTALL_ROOT}" --cache-dir "${CACHE_ZYPPER}" ) \
|
|
|
|
&& zypper "${ZYPPER_OPTIONS[@]}" --gpg-auto-import-keys refresh \
|
2023-10-13 17:07:38 +02:00
|
|
|
&& rpm -e util-linux --nodeps \
|
2023-03-22 10:56:59 +01:00
|
|
|
&& zypper "${ZYPPER_OPTIONS[@]}" --non-interactive install --download-in-advance --no-recommends \
|
2024-10-14 17:51:24 +02:00
|
|
|
bash procps grep gawk sed coreutils busybox ldns libidn2-0 socat openssl curl \
|
2023-10-13 17:07:38 +02:00
|
|
|
&& zypper up -y \
|
2023-03-22 10:56:59 +01:00
|
|
|
&& zypper "${ZYPPER_OPTIONS[@]}" clean --all
|
2023-03-22 10:13:18 +01:00
|
|
|
## Cleanup (reclaim approx 13 MiB):
|
|
|
|
# None of this content should be relevant to the container:
|
|
|
|
RUN rm -r "${INSTALL_ROOT}/usr/share/"{licenses,man,locale,doc,help,info}
|
|
|
|
# Functionality that the container doesn't need:
|
2023-03-22 10:56:59 +01:00
|
|
|
RUN rm "${INSTALL_ROOT}/usr/share/misc/termcap" \
|
2023-03-22 10:13:18 +01:00
|
|
|
&& rm -r "${INSTALL_ROOT}/usr/lib/sysimage/rpm"
|
2023-03-22 09:18:36 +01:00
|
|
|
|
|
|
|
|
|
|
|
# Create a new image with the contents of $INSTALL_ROOT
|
|
|
|
FROM scratch
|
|
|
|
ARG INSTALL_ROOT
|
|
|
|
COPY --link --from=builder ${INSTALL_ROOT} /
|
2023-10-03 18:09:58 +02:00
|
|
|
# Link busybox to tar, see #2403. Create user + (home with SGID set):
|
2023-10-03 15:00:04 +02:00
|
|
|
RUN ln -s /usr/bin/busybox /usr/bin/tar \
|
2024-10-15 09:54:35 +02:00
|
|
|
&& ln -s /usr/bin/busybox /usr/bin/hexdump \
|
2023-10-03 15:00:04 +02:00
|
|
|
&& echo 'testssl:x:1000:1000::/home/testssl:/bin/bash' >> /etc/passwd \
|
2023-03-22 10:13:18 +01:00
|
|
|
&& echo 'testssl:x:1000:' >> /etc/group \
|
|
|
|
&& echo 'testssl:!::0:::::' >> /etc/shadow \
|
|
|
|
&& install --mode 2755 --owner testssl --group testssl --directory /home/testssl \
|
|
|
|
&& ln -s /home/testssl/testssl.sh /usr/local/bin/
|
2017-03-30 13:18:46 +02:00
|
|
|
|
2023-01-31 07:58:17 +01:00
|
|
|
# Copy over build context (after filtered by .dockerignore): bin/ etc/ testssl.sh
|
2023-02-07 09:36:47 +01:00
|
|
|
COPY --chown=testssl:testssl . /home/testssl/
|
2023-03-22 09:16:50 +01:00
|
|
|
USER testssl
|
2018-02-08 21:06:19 +01:00
|
|
|
ENTRYPOINT ["testssl.sh"]
|
2017-03-30 14:41:46 +02:00
|
|
|
CMD ["--help"]
|