Rework build system further

- Move everything related to base/ into that directory, including Containerfile
- Introduce `bootc-base-image-rebuild-self` that can be used to
  resynthesize the base image, and it has docs.
- Rework the standard image to put its build instructions in
  usr/share/doc/bootc-image-standard to serve as a reference

Signed-off-by: Colin Walters <walters@verbum.org>
This commit is contained in:
Colin Walters committed 2025-02-11 08:57:48 -05:00
1 parent fffbf8853f
commit 6de35e0fc2
14 files changed
+165 -51

No files matched your search

+11 -35
View File
@@ -1,42 +1,18 @@
# This generates the default base image.
# This generates the "standard" base image, deriving from the minimal base.
# This is a local reference by default because we haven't shipped this image yet.
FROM localhost/fedora-bootc:base
# Drop our package sets into /usr/share/doc, so that other things can parse it
COPY packages*.txt /usr/share/doc/fedora-bootc/
# Overlay our defaults
# Copy in our configuration and build scripts. Most of the heavy lifting
# is in `stage-install` which we emit into /usr/share/doc so it can be
# used as a reference in other images.
COPY usr/ /usr/
RUN <<EORUN
set -euo pipefail
dnf_args=()
echo "Loading packages-excluded"
basedir=/usr/share/doc/fedora-bootc/
for x in $(grep -E -v '^#' ${basedir}/packages-excluded.txt); do
dnf_args+=(--exclude ${x})
done
echo "Loading packages"
package_files=(${basedir}/packages-recommended-minimal.txt ${basedir}/packages.txt)
pkgfile_for_arch=/usr/share/doc/fedora-bootc/packages-$(arch).txt
if test -f ${pkgfile_for_arch}; then
echo "Loading ${pkgfile_for_arch}"
package_files+=(${pkgfile_for_arch})
fi
base_pkgs=$(grep -hE -v '^#' ${package_files[@]})
dnf -y ${dnf_args[@]} install $base_pkgs
# Ensure we regenerate the initramfs with new content
# https://docs.fedoraproject.org/en-US/bootc/initramfs/
kver=$(cd /usr/lib/modules && echo *); dracut -vf /usr/lib/modules/$kver/initramfs.img $kver
# Undo RPM scripts enabling units; we want the presets to be canonical for the base image.
# https://github.com/projectatomic/rpm-ostree/issues/1803
rm -rf /etc/systemd/system/*
systemctl preset-all
rm -rf /etc/systemd/user/*
systemctl --user --global preset-all
dnf clean all
# Lots of cleaning
rm -vrf /var/log /var/cache /var/lib/dnf
set -xeuo pipefail
# This script installs our default packages. These scripts
# are not a stable API, but may become one in the future.
/usr/share/doc/bootc-image-standard/stage-install
# Cleanup
/usr/share/doc/bootc-image-standard/stage-clean
# And lint.
bootc container lint
EORUN