bootc-base-images/Containerfile

36 lines
1.5 KiB
Docker

# This generates the default base image.
# This is a local reference by default because we haven't shipped this image yet.
FROM localhost/fedora-bootc:base as rootfs
# Drop this into /usr/share/doc, so that other things can parse it
COPY packages-recommended.txt /usr/share/doc/fedora-bootc/packages-recommended.txt
RUN <<EORUN
set -xeuo pipefail
grep -E -v '^#' /usr/share/doc/fedora-bootc/packages-recommended.txt | xargs dnf -y install
# 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
dnf clean all
rm -vf /var/log/dnf*
bootc container lint
EORUN
# This image just needs rpm-ostree in the end that has
# https://github.com/coreos/rpm-ostree/issues/5221
FROM registry.gitlab.com/fedora/bootc/base-images-dev/fedora-bootc-dev:rawhide as builder
RUN --mount=type=bind,rw=true,src=.,dst=/buildcontext,bind-propagation=shared \
--mount=from=rootfs,dst=/rootfs <<EORUN
set -xeuo pipefail
rm /buildcontext/out.oci -rf
rpm-ostree experimental compose build-chunked-oci --bootc --format-version=1 \
--rootfs=/rootfs --output /buildcontext/out.oci
EORUN
FROM oci:./out.oci
# Need to reference builder here to force ordering. But since we have to run
# something anyway, we might as well cleanup after ourselves.
RUN --mount=type=bind,from=builder,src=.,target=/var/tmp \
--mount=type=bind,rw=true,src=.,dst=/buildcontext,bind-propagation=shared rm /buildcontext/out.oci -rf