3939# bootc binaries in /out. The intention is that the target rootfs is extracted from /out
4040# back into a final stae (without the build deps etc) below.
4141FROM base as build
42+ # Flip this on to enable initramfs code
43+ ARG initramfs=0
4244# This installs our package dependencies, and we want to cache it independently of the rest.
4345# Basically we don't want changing a .rs file to blow out the cache of packages. So we only
4446# copy files necessary
@@ -59,8 +61,14 @@ COPY --from=src /src /src
5961WORKDIR /src
6062# See https://www.reddit.com/r/rust/comments/126xeyx/exploring_the_problem_of_faster_cargo_docker/
6163# We aren't using the full recommendations there, just the simple bits.
62- RUN --mount=type=cache,target=/build/target --mount=type=cache,target=/var/roothome \
63- make && make install-all DESTDIR=/out
64+ RUN --mount=type=cache,target=/build/target --mount=type=cache,target=/var/roothome <<EORUN
65+ set -xeuo pipefail
66+ make
67+ make install-all DESTDIR=/out
68+ if test "${initramfs:-}" = 1; then
69+ make install-initramfs-dracut DESTDIR=/out
70+ fi
71+ EORUN
6472
6573# This "build" just runs our unit tests
6674FROM build as units
@@ -74,6 +82,10 @@ FROM base
7482COPY --from=build /out/ /
7583RUN <<EORUN
7684set -xeuo pipefail
85+ if test -x /usr/lib/bootc/initramfs-setup; then
86+ kver=$(cd /usr/lib/modules && echo *);
87+ env DRACUT_NO_XATTR=1 dracut -vf /usr/lib/modules/$kver/initramfs.img $kver
88+ fi
7789# Only in this containerfile, inject a file which signifies
7890# this comes from this development image. This can be used in
7991# tests to know we're doing upstream CI.
0 commit comments