|
1 | 1 | # 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 | + |
4 | 3 | ARG LEAP_VERSION=15.4 |
5 | | -ARG CACHE_ZYPPER=/tmp/cache/zypper |
6 | 4 | ARG INSTALL_ROOT=/rootfs |
7 | 5 |
|
8 | 6 | FROM opensuse/leap:${LEAP_VERSION} as builder |
9 | | -ARG CACHE_ZYPPER |
| 7 | +ARG CACHE_ZYPPER=/tmp/cache/zypper |
10 | 8 | ARG INSTALL_ROOT |
11 | 9 | # --mount is only necessary for persisting the zypper cache on the build host, |
12 | 10 | # Paired with --cache-dir below, RUN layer invalidation does not clear this cache. |
13 | 11 | # Not useful for CI, only local builds that retain the storage. |
14 | 12 | 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 | | - |
39 | 13 | # Provides $VERSION_ID |
40 | 14 | 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. |
45 | 15 | ZYPPER_OPTIONS=( |
46 | 16 | --releasever "${VERSION_ID}" |
47 | 17 | --installroot "${INSTALL_ROOT}" |
48 | 18 | --cache-dir "${CACHE_ZYPPER}" |
49 | 19 | ) |
50 | 20 |
|
51 | | - # Sync package repos to get latest updates: |
| 21 | + # Sync package repos: |
52 | 22 | zypper ${ZYPPER_OPTIONS[@]} --gpg-auto-import-keys refresh |
53 | 23 |
|
54 | 24 | 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 |
57 | 27 |
|
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 |
60 | 28 |
|
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: |
62 | 31 | 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: |
64 | 33 | rm "${INSTALL_ROOT}/usr/share/misc/termcap" |
65 | 34 | rm -r "${INSTALL_ROOT}/usr/lib/sysimage/rpm" |
66 | 35 | EOF |
|
0 commit comments