Skip to content

refactor(dockerfile): Change base Alpine (3.17) => openSUSE Leap (15.4) - #2344

Merged
drwetter merged 6 commits into
testssl:suse_dockerfrom
polarathene:refactor/dockerfile-to-opensuse
Mar 22, 2023
Merged

drwetter merged 6 commits into
testssl:suse_dockerfrom
polarathene:refactor/dockerfile-to-opensuse

Conversation

@polarathene

@polarathene polarathene commented Mar 22, 2023 •

Copy link
Copy Markdown
Contributor

Based on feedback at: https://github.com/drwetter/testssl.sh/issues/2299#issuecomment-1471704041

Image size on disk:

  • Alpine: 36.6 MiB
  • Leap: 55.5 MiB

Main benefit is to move off musl, this comes at the expense of a slightly larger image.

One issue related to this was the static built openssl relies on glibc for some DNS logic which would fail on Alpine (non-issue when using the openssl package from Alpine).

Commits have messages for context on changes. Some inline docs have been dropped but could be brought back if desired. Less practical without the BuildKit features that were dropped though.


docker run --rm -it drwetter/testssl.sh:3.1dev --openssl /usr/bin/openssl google.com:

  • Alpine (OpenSSL 3.0.8): 196 sec
  • Leap (OpenSSL 1.1.1l): 108 sec

Run on a Fedora 37 VPS host with 2 vCPU.


For reference, since git blame becomes less helpful, these links should assist with any traceability going forward:

BusyBox `adduser` was reading config from `/etc` that unnecessarily populates the home folder with various dot files.

Alternative approach is to create the user and home folder manually. This avoids some extra files like the `-` suffixed backup copies from `adduser`.
The additions from `adduser` reading `/etc` does not appear to apply if the directory already exists, and permissions (including SGID) are adjusted properly for the home dir.

This mean the excess backup copies in `/etc` are introduced again however.
- 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.
These have been available via opt-in prior to v23 of Docker Engine with `DOCKER_BUILDKIT=1` ENV as a prefix to running `docker build`, however it's been requested to avoid the syntax.

No HereDoc (multi-line RUN with EOF marker) or `RUN --mount` available. This makes the `busybox` approach a hassle, so I've brought back the explicit creation of user and home dir.

Without the cache mounts, bring back `zypper clean`. It's not doing much as the `--cache-dir` is still set, but should reduce disk space for the `builder` layer. Local builds will be slower as a result when this layer is invalidated.

AFAIK, this also makes it tricky to use the `ZYPPER_OPTIONS`? So no longer DRY.
@drwetter

Copy link
Copy Markdown
Collaborator

Very cool, thanks!

Performance benefit: 👍

I reconfigured on dockerhub to include this branch, so that others including myself can try. That is stuff not for this day but should get this finalized hopefully by Friday

@drwetter

Copy link
Copy Markdown
Collaborator

First tests: works like a charm 👍 Good work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants