Installing the job container's tools upgrades base packages once Ubuntu has newer ones, and the purge does not downgrade them, so the version check failed every image. Kaniko now empties the root filesystem and unpacks the base image before its first snapshot (--pre-cleanup), so the versions no longer matter. Extra packages and files no package owns still fail the job. With the filesystem emptied, a failed build can leave no rm for the last step, so the build step empties the credential file itself. The images also kept the base image's package versions. Each Dockerfile now upgrades them, and the base digests move to the newest published. Refs #508 Assisted-by: Claude Code
63 lines
4.3 KiB
Docker
63 lines
4.3 KiB
Docker
# Molecule test target for the roles of this Collection: Ubuntu 24.04 with systemd
|
|
# as PID 1 and the fixtures the scenarios need preinstalled. A package a role installs
|
|
# is not baked in, so its scenario exercises the install (ADR 0002). It replaces the
|
|
# molecule test image that used to be built locally on the CI runner.
|
|
#
|
|
# Built by .gitea/workflows/image.yml with kaniko and pushed (never on pull
|
|
# requests) to git.rkdr.net/mortis/molecule-ubuntu2404. Consumers reference it
|
|
# by digest, never by tag:
|
|
#
|
|
# container:
|
|
# image: git.rkdr.net/mortis/molecule-ubuntu2404@sha256:<digest>
|
|
#
|
|
# or, in a molecule scenario: platforms[].image with pre_build_image: true. The
|
|
# scenario starts it with command /sbin/init, cgroupns_mode host, /sys/fs/cgroup
|
|
# mounted rw, tmpfs on /run and /run/lock, capability NET_ADMIN. No privileged mode.
|
|
#
|
|
# One RUN layer: at most about 30 MB compressed on top of the 29.8 MB base (estimated from
|
|
# the real .debs, with the .pyc files the postinst scripts compile), far below
|
|
# Cloudflare's 100 MB request-body limit on git.rkdr.net (kaniko pushes a layer as
|
|
# one request; gnupg adds a few MB, not measured, and the upgraded base packages about 4 MB).
|
|
# apt packages are not version-pinned, as in the original image; the
|
|
# base image is pinned by digest and a rebuild is a reviewed digest bump downstream.
|
|
#
|
|
# The image carries SSH host keys and a machine-id generated at build time (the
|
|
# openssh-server and systemd postinst scripts). ssh.service runs `sshd -t` and
|
|
# fails without host keys, so they cannot be removed; image scanners will flag them.
|
|
# They are throwaway keys of a test target that is never exposed.
|
|
# ubuntu:24.04 index digest as of 2026-12-03.
|
|
FROM ubuntu:24.04@sha256:168a88cc61bdd95c8f871e3903d4e0a525e340c2b28a70dadd6d1503ecc7c391
|
|
|
|
LABEL org.opencontainers.image.title="molecule-ubuntu2404" \
|
|
org.opencontainers.image.description="Disposable Ubuntu 24.04 test target for the molecule scenarios of the mortis.kamino Ansible Collection. systemd runs as PID 1 with D-Bus, sudo, python3 and the test fixtures (iptables, openssh-server, gnupg) preinstalled. A package a role installs is not baked in and no APT lists are kept, so a scenario refreshes the APT cache before a role installs one. Start it as a molecule platform (usage label); it carries throwaway SSH host keys and is a test target only, never to be exposed." \
|
|
org.opencontainers.image.source="https://git.rkdr.net/mortis/kamino" \
|
|
org.opencontainers.image.url="https://git.rkdr.net/mortis/kamino" \
|
|
org.opencontainers.image.documentation="https://git.rkdr.net/mortis/kamino/src/branch/main/docs/images/molecule-ubuntu2404.md" \
|
|
org.opencontainers.image.licenses="GPL-3.0-or-later" \
|
|
org.opencontainers.image.authors="Defame1297 and contributors" \
|
|
org.opencontainers.image.base.name="ubuntu:24.04" \
|
|
net.rkdr.mortis.purpose="Disposable Ubuntu 24.04 test target for the molecule scenarios of the mortis.kamino Ansible Collection." \
|
|
net.rkdr.mortis.contents="Ubuntu 24.04, systemd, systemd-sysv, dbus, sudo, iproute2, ca-certificates, python3, python3-apt, python3-systemd, iptables, openssh-server (ssh enabled), gnupg" \
|
|
net.rkdr.mortis.usage="Molecule docker-driver platform with pre_build_image true, command /sbin/init, cgroupns_mode host, /sys/fs/cgroup mounted rw, tmpfs on /run and /run/lock, capability NET_ADMIN, security_opts apparmor=unconfined (not privileged). Pin git.rkdr.net/mortis/name:version@sha256:digest. See the documentation label."
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
# The upgrade brings in updates newer than the base image.
|
|
# systemd as PID 1 with D-Bus, sudo and networking tools; the Python Ansible needs on
|
|
# the target (python3-apt for the apt module, python3-systemd for the journal); iptables;
|
|
# sshd, enabled so a converge can test it under systemd; gnupg, which the docker scenario
|
|
# signs its stand-in APT repository with. ufw and fail2ban are left out: their roles install them.
|
|
RUN apt-get update \
|
|
&& apt-get upgrade -y --with-new-pkgs --no-install-recommends \
|
|
&& apt-get install -y --no-install-recommends \
|
|
systemd systemd-sysv dbus sudo iproute2 ca-certificates \
|
|
python3 python3-apt python3-systemd \
|
|
iptables \
|
|
openssh-server \
|
|
gnupg \
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
&& systemctl enable ssh
|
|
|
|
STOPSIGNAL SIGRTMIN+3
|
|
CMD ["/sbin/init"]
|