Some checks failed
Build SilverMetal Linux ISO (reproducibility-gated) / build-and-verify (push) Failing after 1m14s
Run #4251 advanced past checkout and into derivative-maker, then died immediately: ERROR: This must NOT be run as root (sudo)! ERROR: Exiting ./derivative-maker with non-zero exit code 1. Errors Detected: 0. Execution Time: 00:00:00. Kicksecure's derivative-maker explicitly refuses to run as root — it expects a regular user with passwordless sudo and uses sudo internally for the privileged operations (debootstrap, mksquashfs, chroot mounts). Our minimal debian-slim builder image had a `builder` user (uid 1000) but no sudo, no sudoers entry, and the container ran as root. Aligns with the upstream Kicksecure container pattern at linux/build/derivative-maker/docker/derivative-maker-docker-setup (uses USER=user with `${USER} ALL=(ALL) NOPASSWD:ALL`). Changes: - Dockerfile.builder: install `sudo` (and `fakeroot` while we're here — upstream sanity-tests pulls this in via apt at build time, but having it baked avoids a snapshot.debian.org round-trip every run); add passwordless sudoers entry for builder; correct the misleading comment that claimed root was needed. - New scripts/build-inner.sh: the inner derivative-maker invocation pulled out of build.sh's heredoc. Once we needed to drop privileges via runuser, the nested-heredoc / nested-quoting situation became unmaintainable; a regular script with normal quoting is far cleaner. - build.sh: inner heredoc now just chowns the workspace to builder and runuser's into build-inner.sh. ${REPO_ROOT} and ${BUILD_DIR} continue to be forwarded into the container via -e. - build.sh: BUILDER_IMAGE digest re-pinned to sha256:f8f0db37…1bedc (rebuilt and pushed natively on 10.0.0.51 — never on the WSL/aarch64 dev box, see reference_silvermetal_runner.md memory). Verified: bash -n on both scripts; image builds and pushes cleanly. Pushing this commit triggers a fresh CI run that will exercise it. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
83 lines
3.6 KiB
Ruby
83 lines
3.6 KiB
Ruby
# SilverMetal Linux — reproducible-build runner image.
|
|
#
|
|
# This image is the "build host" for the ISO. Pinning it by digest is the
|
|
# only thing keeping host-toolchain drift out of the reproducibility gate, so
|
|
# do NOT replace the FROM line with a tag-only reference.
|
|
#
|
|
# Build & push (run from repo root):
|
|
# docker build \
|
|
# -f linux/build/docker/Dockerfile.builder \
|
|
# -t docker-registry:5000/silvermetal-builder:<commit> \
|
|
# -t docker-registry:5000/silvermetal-builder:latest \
|
|
# linux/build/docker
|
|
# docker push docker-registry:5000/silvermetal-builder:<commit>
|
|
#
|
|
# To bump the base image: replace the digest, rebuild, push, update
|
|
# BUILDER_IMAGE in linux/build/scripts/build.sh, run a full reproducibility
|
|
# check, commit all four changes together.
|
|
|
|
# debian:bookworm-slim — pinned by digest.
|
|
# Resolved 2026-04-26 via `docker pull debian:bookworm-slim`.
|
|
# Bumping this requires rebuilding + pushing the silvermetal-builder image
|
|
# AND updating BUILDER_IMAGE in linux/build/scripts/build.sh in the same commit.
|
|
FROM debian:bookworm-slim@sha256:f9c6a2fd2ddbc23e336b6257a5245e31f996953ef06cd13a59fa0a1df2d5c252
|
|
|
|
# Reproducibility-friendly apt configuration.
|
|
ENV DEBIAN_FRONTEND=noninteractive \
|
|
LC_ALL=C.UTF-8 \
|
|
LANG=C.UTF-8 \
|
|
SOURCE_DATE_EPOCH=0
|
|
|
|
# Pinned package versions. These come from the same snapshot.debian.org
|
|
# timestamp as the ISO build, so a Dockerfile rebuild against that snapshot
|
|
# produces the same toolchain bit-for-bit. The actual snapshot URL is
|
|
# substituted at build time via --build-arg APT_SNAPSHOT_URL=...
|
|
ARG APT_SNAPSHOT_URL="https://snapshot.debian.org/archive/debian/20260415T000000Z"
|
|
ARG APT_SECURITY_SNAPSHOT_URL="https://snapshot.debian.org/archive/debian-security/20260415T000000Z"
|
|
|
|
# Two-phase install:
|
|
# 1. Use the base image's default mirror to seed ca-certificates so HTTPS
|
|
# to snapshot.debian.org works. (slim images don't ship CA bundles.)
|
|
# 2. Pin sources.list to the snapshot and install the actual toolchain.
|
|
# The first phase touches deb.debian.org without a pin; that's fine because
|
|
# nothing it installs ends up in the final ISO — only the toolchain installed
|
|
# in phase 2 does, and that is fully snapshot-pinned.
|
|
RUN set -eux; \
|
|
apt-get update; \
|
|
apt-get install -y --no-install-recommends ca-certificates; \
|
|
rm -f /etc/apt/sources.list.d/*; \
|
|
printf 'deb [check-valid-until=no] %s bookworm main\n' "$APT_SNAPSHOT_URL" > /etc/apt/sources.list; \
|
|
printf 'deb [check-valid-until=no] %s bookworm-security main\n' "$APT_SECURITY_SNAPSHOT_URL" >> /etc/apt/sources.list; \
|
|
apt-get -o Acquire::Check-Valid-Until=false update; \
|
|
apt-get install -y --no-install-recommends \
|
|
debootstrap \
|
|
diffoscope-minimal \
|
|
dosfstools \
|
|
fakeroot \
|
|
git \
|
|
gnupg \
|
|
isolinux \
|
|
live-build \
|
|
mtools \
|
|
reprepro \
|
|
rsync \
|
|
squashfs-tools \
|
|
sudo \
|
|
syslinux-common \
|
|
xorriso; \
|
|
apt-get clean; \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
# Non-root user for derivative-maker.
|
|
# Kicksecure's derivative-maker explicitly refuses to run as root and uses
|
|
# sudo internally for its privileged operations (debootstrap, mksquashfs,
|
|
# chroot mounts). build.sh chowns the workspace to this user inside the
|
|
# container, then runuser's to it before invoking derivative-maker.
|
|
# uid 1000 is conventional and plays nicely with bind mounts of files
|
|
# created by other Linux tools.
|
|
RUN useradd --uid 1000 --create-home --shell /bin/bash builder \
|
|
&& echo 'builder ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/builder \
|
|
&& chmod 440 /etc/sudoers.d/builder
|
|
|
|
WORKDIR /work
|