|
1 | 1 | FROM registry.opensuse.org/opensuse/tumbleweed:latest |
2 | 2 |
|
3 | | -COPY files/37composefs/ /usr/lib/dracut/modules.d/37composefs/ |
4 | | -COPY files/ostree/prepare-root.conf /usr/lib/ostree/prepare-root.conf |
5 | | - |
6 | | -RUN zypper install -y ostree-devel git cargo rust |
7 | | - |
8 | | -RUN --mount=type=tmpfs,dst=/tmp cd /tmp && \ |
9 | | - git clone https://github.com/bootc-dev/bootc.git bootc && \ |
10 | | - cd bootc && \ |
11 | | - git fetch --all && \ |
12 | | - git switch origin/composefs-backend -d && \ |
13 | | - cargo build --release --bins --features "pre-6.15" && \ |
14 | | - install -Dpm0755 -t /usr/bin ./target/release/bootc && \ |
15 | | - install -Dpm0755 -t /usr/bin ./target/release/system-reinstall-bootc && \ |
16 | | - install -Dpm0755 -t /usr/bin ./target/release/bootc-initramfs-setup |
17 | | - |
18 | | -RUN --mount=type=tmpfs,dst=/tmp cd /tmp && \ |
19 | | - git clone https://github.com/p5/coreos-bootupd.git bootupd && \ |
20 | | - cd bootupd && \ |
21 | | - git fetch --all && \ |
22 | | - git switch origin/sdboot-support -d && \ |
23 | | - cargo build --release --bins --features systemd-boot && \ |
24 | | - install -Dpm0755 -t /usr/bin ./target/release/bootupd && \ |
25 | | - ln -s ./bootupd /usr/bin/bootupctl |
26 | | - |
27 | 3 | RUN zypper install -y \ |
28 | | - dracut \ |
29 | | - composefs \ |
30 | | - composefs-experimental \ |
31 | | - kernel-default \ |
32 | | - kernel-firmware-all \ |
33 | | - systemd \ |
34 | | - btrfs-progs \ |
35 | | - e2fsprogs \ |
36 | | - xfsprogs \ |
37 | | - udev \ |
38 | | - cpio \ |
39 | | - zstd \ |
40 | | - binutils \ |
41 | | - dosfstools \ |
42 | | - conmon \ |
43 | | - crun \ |
44 | | - netavark \ |
45 | | - skopeo \ |
46 | | - dbus-1 \ |
47 | | - dbus-1-daemon \ |
48 | | - dbus-broker \ |
49 | | - systemd-boot |
50 | | - |
51 | | -RUN cp /usr/bin/bootc-initramfs-setup /usr/lib/dracut/modules.d/37composefs |
52 | | - |
53 | | -RUN echo 'add_drivers+=" erofs "' >> /etc/dracut.conf.d/composefs.conf |
54 | | - |
55 | | -RUN echo "$(basename "$(find /usr/lib/modules -maxdepth 1 -type d | grep -v -E "*.img" | tail -n 1)")" > kernel_version.txt && \ |
56 | | - dracut --force --add debug --no-hostonly --reproducible --zstd --verbose --kver "$(cat kernel_version.txt)" "/usr/lib/modules/$(cat kernel_version.txt)/initramfs.img" && \ |
57 | | - rm kernel_version.txt |
58 | | - |
59 | | -# Alter root file structure a bit for ostree |
60 | | -RUN mkdir -p /boot /sysroot /var/home && \ |
61 | | - rm -rf /var/log /home /root /usr/local /srv && \ |
62 | | - ln -s /var/home /home && \ |
63 | | - ln -s /var/roothome /root && \ |
64 | | - ln -s /var/usrlocal /usr/local && \ |
65 | | - ln -s /var/srv /srv |
| 4 | + binutils \ |
| 5 | + btrfs-progs \ |
| 6 | + cpio \ |
| 7 | + dosfstools \ |
| 8 | + dracut \ |
| 9 | + e2fsprogs \ |
| 10 | + glib2 \ |
| 11 | + kernel-default \ |
| 12 | + kernel-firmware-all \ |
| 13 | + skopeo \ |
| 14 | + systemd \ |
| 15 | + systemd-boot \ |
| 16 | + udev \ |
| 17 | + xfsprogs \ |
| 18 | + zstd && \ |
| 19 | + zypper clean -a |
| 20 | + |
| 21 | +ENV DEV_DEPS="git rust make cargo gcc-devel glib2-devel libzstd-devel openssl-devel ostree-devel" |
| 22 | +RUN --mount=type=tmpfs,dst=/tmp --mount=type=tmpfs,dst=/root \ |
| 23 | + zypper install -y ${DEV_DEPS} && \ |
| 24 | + git clone "https://github.com/bootc-dev/bootc.git" /tmp/bootc && \ |
| 25 | + make -C /tmp/bootc bin install-all install-initramfs-dracut && \ |
| 26 | + sh -c 'export KERNEL_VERSION="$(basename "$(find /usr/lib/modules -maxdepth 1 -type d | grep -v -E "*.img" | tail -n 1)")" && \ |
| 27 | + dracut --force --no-hostonly --force-drivers erofs --reproducible --zstd --verbose --kver "$KERNEL_VERSION" "/usr/lib/modules/$KERNEL_VERSION/initramfs.img"' && \ |
| 28 | + zypper remove -y ${DEV_DEPS} && \ |
| 29 | + zypper clean -a |
| 30 | +ENV DEV_DEPS="" |
| 31 | + |
| 32 | +# Necessary for general behavior expected by image-based systems |
| 33 | +RUN echo "HOME=/var/home" | tee "/etc/default/useradd" && \ |
| 34 | + rm -rf /boot /home /root /usr/local /srv && \ |
| 35 | + mkdir -p /var /sysroot /boot /usr/lib/ostree && \ |
| 36 | + ln -s var/opt /opt && \ |
| 37 | + ln -s var/roothome /root && \ |
| 38 | + ln -s var/home /home && \ |
| 39 | + ln -s sysroot/ostree /ostree && \ |
| 40 | + echo "$(for dir in opt usrlocal home srv mnt ; do echo "d /var/$dir 0755 root root -" ; done)" | tee -a /usr/lib/tmpfiles.d/bootc-base-dirs.conf && \ |
| 41 | + echo "d /var/roothome 0700 root root -" | tee -a /usr/lib/tmpfiles.d/bootc-base-dirs.conf && \ |
| 42 | + echo "d /run/media 0755 root root -" | tee -a /usr/lib/tmpfiles.d/bootc-base-dirs.conf && \ |
| 43 | + printf "[composefs]\nenabled = yes\n[sysroot]\nreadonly = true\n" | tee "/usr/lib/ostree/prepare-root.conf" |
66 | 44 |
|
67 | 45 | # Setup a temporary root passwd (changeme) for dev purposes |
68 | 46 | # TODO: Replace this for a more robust option when in prod |
|
0 commit comments