The current custom base image flow of rebuilding a "built-in" image with custom repos and then adding your own content separate is reasonable, but it would be nice if one could augment the list of packages to install in that initial build rather than as a separate transaction. Then, you don't have to cleanup after dnf and `/var` content, re-inject repo definitions, and refetch repo metadata. It also allows building container images with additional packages without `dnf` necessarily being in the package set. We don't want to leak rpm-ostree implementation details, nor do we want to invent a new format. So just add support for a `--install` arg and a generic `--args-file` to pass arguments via a file. We then generate a new treefile on the fly to extend the `packages` list.
35 lines
990 B
Text
35 lines
990 B
Text
# This test case exercises using the fedora-bootc image as a builder
|
|
# to generate a minimal target image derived from CentOS Stream 10 content,
|
|
# and then further extends it in a secondary phase.
|
|
FROM quay.io/fedora/fedora-bootc:rawhide as repos
|
|
|
|
# This is intentionally a locally built image
|
|
FROM localhost/fedora-bootc as builder
|
|
RUN --mount=type=bind,from=repos,src=/,dst=/repos,rw <<EORUN
|
|
echo -e '--install\nltrace' > args.txt
|
|
/usr/libexec/bootc-base-imagectl --args-file args.txt build-rootfs --manifest=standard/manifest /repos /target-rootfs
|
|
EORUN
|
|
|
|
# This pulls in the rootfs generated in the previous step
|
|
FROM scratch
|
|
COPY --from=builder /target-rootfs/ /
|
|
RUN <<EORUN
|
|
set -xeuo pipefail
|
|
. /usr/lib/os-release
|
|
test "$ID" = fedora
|
|
|
|
rpm -q ltrace
|
|
|
|
# And install a package
|
|
dnf -y install strace
|
|
dnf clean all
|
|
|
|
# Cleanup and lint
|
|
rm -rf /var/log /var/cache/* /var/lib/dnf
|
|
bootc container lint
|
|
EORUN
|
|
LABEL containers.bootc 1
|
|
ENV container=oci
|
|
STOPSIGNAL SIGRTMIN+3
|
|
CMD ["/sbin/init"]
|
|
|