Skip to content

Commit 718eb34

Browse files
committed
chore: Revise Dockerfile
- Removing bulk of the noise from inline documentation. - Packages bundled into single line like previous the Alpine version had. - `CACHE_ZYPPER` is only used as an `ARG` in the `builder` stage. - `zypper clean` wasn't able to clear anything from the install root, other than the `CACHE_ZYPPER` mount.
1 parent 0b86094 commit 718eb34

1 file changed

Lines changed: 8 additions & 39 deletions

File tree

Dockerfile

Lines changed: 8 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,35 @@
11
# syntax=docker.io/docker/dockerfile:1
2-
# HereDoc (EOF) feature (avoids needing `&& \`) requires BuildKit:
3-
# https://docs.docker.com/engine/reference/builder/#here-documents
2+
43
ARG LEAP_VERSION=15.4
5-
ARG CACHE_ZYPPER=/tmp/cache/zypper
64
ARG INSTALL_ROOT=/rootfs
75

86
FROM opensuse/leap:${LEAP_VERSION} as builder
9-
ARG CACHE_ZYPPER
7+
ARG CACHE_ZYPPER=/tmp/cache/zypper
108
ARG INSTALL_ROOT
119
# --mount is only necessary for persisting the zypper cache on the build host,
1210
# Paired with --cache-dir below, RUN layer invalidation does not clear this cache.
1311
# Not useful for CI, only local builds that retain the storage.
1412
RUN --mount=type=cache,target="${CACHE_ZYPPER}",sharing=locked <<EOF
15-
INSTALL_DEPS=()
16-
17-
# Mandatory commands. coreutils required over busybox for date command:
18-
# https://github.com/drwetter/testssl.sh/commit/d1f03801738c87b6af39372c45e048af78c73c09
19-
INSTALL_DEPS+=(bash procps grep gawk sed coreutils)
20-
21-
# Support better performance and debugging than hexdump via xxd:
22-
# https://github.com/drwetter/testssl.sh/pull/1862
23-
# busybox-util-linux (mandatory: hexdump) + busybox-vi (optional: xxd)
24-
INSTALL_DEPS+=( busybox-util-linux busybox-vi )
25-
26-
# Support IDN (Internationalized Domain Names) lookups with drill:
27-
# https://github.com/drwetter/testssl.sh/pull/1326
28-
INSTALL_DEPS+=( ldns libidn2-0 )
29-
30-
# Support StartTLS injection:
31-
# https://github.com/drwetter/testssl.sh/pull/1810
32-
INSTALL_DEPS+=( socat openssl )
33-
34-
# Support --phone-out checks:
35-
# https://github.com/drwetter/testssl.sh/commit/a66f5cfdbcd93427f4408bdd8cfc336488c02bb8
36-
INSTALL_DEPS+=( curl )
37-
38-
3913
# Provides $VERSION_ID
4014
source /etc/os-release
41-
42-
# --releasever required due to no version info in install root.
43-
# --installroot installs to location as if it was the system root.
44-
# --cache-dir with above `RUN --mount` speeds this step up.
4515
ZYPPER_OPTIONS=(
4616
--releasever "${VERSION_ID}"
4717
--installroot "${INSTALL_ROOT}"
4818
--cache-dir "${CACHE_ZYPPER}"
4919
)
5020

51-
# Sync package repos to get latest updates:
21+
# Sync package repos:
5222
zypper ${ZYPPER_OPTIONS[@]} --gpg-auto-import-keys refresh
5323

5424
zypper ${ZYPPER_OPTIONS[@]} --non-interactive install \
55-
--download-in-advance --no-recommends ${INSTALL_DEPS[@]}
56-
25+
--download-in-advance --no-recommends \
26+
bash procps grep gawk sed coreutils busybox-util-linux busybox-vi ldns libidn2-0 socat openssl curl
5727

58-
# Clears the cache, but this is not stored in the install root location (like DNF does), thus not useful.
59-
# zypper ${ZYPPER_OPTIONS[@]} clean --all
6028

61-
# Unlike DNF, there isn't a `--nodocs` install option, manually remove some excess weight (9 MiB):
29+
## Cleanup (reclaim approx 13 MiB):
30+
# None of this content should be relevant to the container:
6231
rm -r "${INSTALL_ROOT}/usr/share/"{licenses,man,locale,doc,help,info}
63-
# Neither of these should be needed in the container, removes 4MiB
32+
# Functionality that the container doesn't need:
6433
rm "${INSTALL_ROOT}/usr/share/misc/termcap"
6534
rm -r "${INSTALL_ROOT}/usr/lib/sysimage/rpm"
6635
EOF

0 commit comments

Comments
 (0)