39
39
# bootc binaries in /out. The intention is that the target rootfs is extracted from /out
40
40
# back into a final stae (without the build deps etc) below.
41
41
FROM base as build
42
+ # Flip this on to enable initramfs code
43
+ ARG initramfs=0
42
44
# This installs our package dependencies, and we want to cache it independently of the rest.
43
45
# Basically we don't want changing a .rs file to blow out the cache of packages. So we only
44
46
# copy files necessary
@@ -59,8 +61,14 @@ COPY --from=src /src /src
59
61
WORKDIR /src
60
62
# See https://www.reddit.com/r/rust/comments/126xeyx/exploring_the_problem_of_faster_cargo_docker/
61
63
# 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
64
72
65
73
# This "build" just runs our unit tests
66
74
FROM build as units
@@ -74,6 +82,10 @@ FROM base
74
82
COPY --from=build /out/ /
75
83
RUN <<EORUN
76
84
set -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
77
89
# Only in this containerfile, inject a file which signifies
78
90
# this comes from this development image. This can be used in
79
91
# tests to know we're doing upstream CI.
0 commit comments