sector-f-linux

Sector F Linux
git clone https://git.sectorflabs.com/sector-f-linux.git
Log | Files | Refs | README | LICENSE

Containerfile (12277B)


      1 # Patina OS: Fedora 45's bootc image with the Patina desktop and what it needs,
      2 # logged into through greetd and a Patina greeter, on Btrfs (ADR-0009). Two images come out of it:
      3 #
      4 #   system   the real one
      5 #   dev      the system plus what the test VM needs: a user to log in as, and
      6 #            trust in the development registry (vm/README.md)
      7 #
      8 # The desktop is built first by desktop/build.sh, into build/desktop/, the greeter by
      9 # greeter-build.sh, into build/greeter/, and the updater by updater-build.sh, into build/updater/.
     10 
     11 # Fedora's own bootc image, on the 45 tag so it follows Fedora's rebuilds (a digest pin stops
     12 # resolving once upstream drops it): the best-tested base bootc has, with its own kernel, so none
     13 # of the workarounds the Ubuntu base needed (a newer bootc and kernel, dpkg's state) are here.
     14 FROM quay.io/fedora/fedora-bootc:45 AS base
     15 
     16 # The boot and shutdown splash (Plymouth): Fedora's spinner theme, tinted in the greeter's
     17 # Everforest colours, with the logo. Built here so Pillow and rsvg-convert stay out of the image.
     18 FROM base AS plymouth-theme
     19 RUN dnf -y --setopt=install_weak_deps=False install plymouth-theme-spinner python3-pillow librsvg2-tools && \
     20     dnf clean all
     21 COPY branding/plymouth-theme.py /plymouth-theme.py
     22 COPY system/usr/share/pixmaps/seflos-logo.svg /logo.svg
     23 RUN python3 /plymouth-theme.py /usr/share/plymouth/themes/spinner /logo.svg /sectorf
     24 
     25 FROM base AS system
     26 
     27 # What the desktop needs: greetd and cage to log in (the greeter itself is ours, below),
     28 # AccountsService for the accounts, NetworkManager (patina-wifi), PipeWire
     29 # and WirePlumber (wpctl, for the volume keys), Mesa (EGL, GBM, Vulkan),
     30 # libinput, libseat, xkb's layouts, fonts and the icon themes, and foot as a
     31 # terminal. The libraries are what the binaries link or load: GTK4 and WebKitGTK
     32 # (the web view), ALSA (dictation and Montage), Vulkan, OpenSSL and the rest.
     33 # For Files: the desktop portal, whose file chooser it is in the Patina session
     34 # (GTK's backend answers the rest, as patina-portals.conf says), file types from
     35 # shared-mime-info, and xdg-open for opening files in their apps. The programs
     36 # patina-desktop's packaging/bundle.toml lists as required: gsettings (glib2),
     37 # Xwayland, and ffmpeg (Fedora's, which has the free codecs only).
     38 #
     39 # And what nifl, the ThinkPad X1 Carbon this is meant to run on, needs from the
     40 # base (checked by comparing its installed packages and services): Bluetooth,
     41 # power profiles, Thunderbolt authorisation (bolt), firmware updates (fwupd),
     42 # thermald, sensors, printing, the fingerprint service, Tailscale, OpenVPN,
     43 # Avahi, ModemManager, QEMU, and fastfetch. nifl's drivers are all in the
     44 # kernel. Btrfs's tools are in the base; snapshots of /home come with it later.
     45 #
     46 # Wi-Fi: Fedora's NetworkManager has no Wi-Fi in it (NetworkManager-wifi, which needs wpa_supplicant),
     47 # and with weak dependencies off linux-firmware brings none of Intel's Wi-Fi and Bluetooth firmware
     48 # (the others, Broadcom, Atheros, MediaTek, Realtek, are in it). Without these there is no Wi-Fi
     49 # device, and the desktop's Wi-Fi menu has nothing to show.
     50 #
     51 # Network shares: Files browses and mounts them through GVfs (patina-desktop's ADR-0005: network:///,
     52 # smb://, and the FUSE bridge in /run/user/<uid>/gvfs), so gvfs, its Samba backend and its FUSE
     53 # bridge; samba-client and cifs-utils are the command-line side (smbclient, mount.cifs).
     54 #
     55 # The web browser: Firefox, which Patina's defaults and Alt+B already name. Its desktop file,
     56 # org.mozilla.firefox.desktop, is what the base mimeapps.list gives web links to. Themed to Patina
     57 # by files under system/usr/lib64/firefox (ADR-0018).
     58 #
     59 # Sound: UnAmp (rodio, so cpal) and Montage talk to ALSA, and pipewire-alsa is what routes ALSA's
     60 # default device into PipeWire (without it they open the card directly, or find none). alsa-ucm
     61 # is how ALSA knows a laptop's speakers, headphones and mics, and alsa-sof-firmware is the DSP firmware
     62 # Intel laptops (nifl's included) need to have a sound card at all; linux-firmware does not carry it.
     63 # No codecs are needed for UnAmp: it decodes in Rust (symphonia), not with the system's ffmpeg.
     64 #
     65 # Not here yet: the NVIDIA driver, which comes from RPM Fusion or NVIDIA's own
     66 # repository and is built against the image's kernel at build time.
     67 RUN dnf -y --setopt=install_weak_deps=False install \
     68         plymouth plymouth-plugin-two-step greetd cage accountsservice dconf polkit NetworkManager \
     69         pipewire pipewire-pulseaudio pipewire-alsa wireplumber \
     70         alsa-ucm alsa-sof-firmware \
     71         mesa-dri-drivers mesa-vulkan-drivers mesa-libEGL mesa-libgbm vulkan-loader \
     72         libinput libseat libxkbcommon xkeyboard-config pixman libdrm \
     73         gtk4 webkitgtk6.0 alsa-lib openssl-libs fontconfig sqlite-libs libsoup3 pam mpv-libs \
     74         dejavu-sans-fonts google-noto-color-emoji-fonts \
     75         hicolor-icon-theme adwaita-icon-theme yaru-icon-theme \
     76         foot xdg-user-dirs \
     77         xdg-desktop-portal xdg-desktop-portal-gtk xdg-desktop-portal-wlr dbus-tools \
     78         shared-mime-info xdg-utils glib2 xorg-x11-server-Xwayland ffmpeg-free \
     79         bluez power-profiles-daemon bolt fwupd thermald iio-sensor-proxy \
     80         cups cups-browsed cups-filters hplip \
     81         fprintd fprintd-pam \
     82         tailscale openvpn NetworkManager-openvpn avahi ModemManager \
     83         qemu-kvm fastfetch htop microcode_ctl linux-firmware btrfs-progs \
     84         rust cargo clippy rustfmt rust-src rust-analyzer gcc git make \
     85         NetworkManager-wifi wpa_supplicant \
     86         iwlwifi-dvm-firmware iwlwifi-mvm-firmware iwlwifi-mld-firmware iwlegacy-firmware \
     87         iwlbluetooth-firmware libertas-firmware \
     88         samba-client cifs-utils gvfs gvfs-smb gvfs-fuse \
     89         firefox && \
     90     dnf clean all
     91 
     92 # The Patina desktop and Files, and its session: laid out under / by desktop/build.sh. And the
     93 # greeter, laid out by greeter-build.sh.
     94 COPY build/desktop/ /
     95 COPY build/greeter/ /
     96 COPY build/updater/ /
     97 
     98 # Files the system adds to the base, as laid out under system/. Among them,
     99 # boot.automount is masked (a symlink to /dev/null in /etc/systemd/system):
    100 # systemd-gpt-auto-generator puts an automount for the EFI partition on /boot,
    101 # with a 2 minute idle timeout, in front of ostree's /boot bind mount. After it
    102 # idles out, `ostree admin finalize-staged` fails at shutdown ("Remounting /boot
    103 # read-write: Invalid argument") and the staged update is dropped without a
    104 # word: the machine reboots into the old image. Seen on Fedora 45 with bootc
    105 # 1.17.1 and ostree 2026.4 (upstream: cgwalters-forge/tracker#86, ostree#3664,
    106 # bootc#2402, fixed in bootc 1.18). Remove the mask when the base carries the fix.
    107 # bootc-fetch-apply-updates.timer is masked the same way: it runs `bootc upgrade
    108 # --apply`, which reboots the machine by itself when an update arrives, and
    109 # refuses on one with a layered package. Updates are the user's to start, with
    110 # `rpm-ostree upgrade` (ADR-0009). /etc/hostname is here because the initramfs
    111 # carries Fedora's os-release, whose DEFAULT_HOSTNAME ("fedora") wins otherwise.
    112 COPY system/ /
    113 # The defaults for GNOME's settings that system/ overrides (usr/share/glib-2.0/schemas/*.override, ADR-0020)
    114 # only take effect once the schemas are compiled again. This fails the build if an override is not valid.
    115 RUN glib-compile-schemas --strict /usr/share/glib-2.0/schemas
    116 
    117 # The splash: the theme, set as the default, and an initramfs that carries Plymouth and the theme, so
    118 # the splash is up from the first moment and not only after the root is mounted. The initramfs is
    119 # rebuilt as the bootc docs do (generic, reproducible), keeping the base's own dracut config. The
    120 # kernel arguments that hide the boot messages and ask for the splash are in
    121 # system/usr/lib/bootc/kargs.d/20-splash.toml. Plymouth shows it for the graphical boot only: a
    122 # rescue or text boot, or `plymouth.enable=0` on the command line, shows the messages as before.
    123 COPY --from=plymouth-theme /sectorf /usr/share/plymouth/themes/sectorf
    124 RUN printf '[Daemon]\nTheme=sectorf\nShowDelay=0\n' > /etc/plymouth/plymouthd.conf && \
    125     kver=$(ls /usr/lib/modules) && \
    126     DRACUT_NO_XATTR=1 dracut --no-hostonly --kver "$kver" --reproducible --zstd --add plymouth \
    127         -f "/usr/lib/modules/$kver/initramfs.img"
    128 
    129 RUN systemctl enable greetd.service NetworkManager.service \
    130         bluetooth.service power-profiles-daemon.service thermald.service \
    131         cups.socket cups.service cups-browsed.service avahi-daemon.service \
    132         ModemManager.service tailscaled.service fwupd-refresh.timer && \
    133     systemctl set-default graphical.target
    134 
    135 RUN bootc container lint
    136 
    137 # ---------------------------------------------------------------------------
    138 
    139 FROM system AS dev
    140 
    141 # A user to log in as at the greeter: patina, password patina, allowed sudo (wheel).
    142 # Its home is made at boot, since /var starts empty.
    143 RUN useradd -M -d /var/home/patina -s /bin/bash -G wheel patina && \
    144     echo patina:patina | chpasswd && \
    145     echo 'd /var/home/patina 0700 patina patina -' > /usr/lib/tmpfiles.d/patina-dev-user.conf
    146 
    147 # Which build this is, so an upgrade can be seen to have happened.
    148 ARG BUILD_ID=unknown
    149 RUN mkdir -p /usr/lib/patina-os && echo "$BUILD_ID" > /usr/lib/patina-os/build
    150 
    151 RUN bootc container lint
    152 
    153 # ---------------------------------------------------------------------------
    154 # The live disc (ADR-0014): the base, not the system, since it boots straight into the installer and
    155 # needs no desktop: greetd and cage, the installer (patina-installer, built by installer-build.sh), the splash,
    156 # and what the container-native ISO contract asks of an image (ADR-0010): dracut-live in the
    157 # initramfs so it can boot the squashfs, the ISO tools, GRUB's EFI binaries, iso.yaml. linux/live/
    158 # build.sh turns it into an ISO with the system image as the offline payload.
    159 FROM base AS live
    160 RUN dnf -y --setopt=install_weak_deps=False install \
    161         greetd cage plymouth plymouth-plugin-two-step dracut-live dracut-config-generic \
    162         xorriso isomd5sum squashfs-tools grub2-tools grub2-efi-x64 grub2-efi-x64-cdboot shim-x64 python3 \
    163         mesa-dri-drivers mesa-libEGL mesa-libgbm vulkan-loader mesa-vulkan-drivers \
    164         libinput libseat libxkbcommon xkeyboard-config pixman libdrm dejavu-sans-fonts \
    165         fontconfig polkit && \
    166     dnf clean all
    167 # GRUB's and shim's EFI binaries where the contract looks for them.
    168 RUN mkdir -p /boot/efi && cp -ra /usr/lib/efi/*/*/EFI /boot/efi/
    169 COPY build/installer/ /
    170 COPY live/etc/ /etc/
    171 COPY live/usr/ /usr/
    172 # What the install command installs, and what the installed machine then follows: the payload
    173 # (an image in this disc's container storage, put there by image-builder) and the registry image the
    174 # machine updates from. Set by live/build.sh.
    175 ARG PAYLOAD_REF=
    176 ARG TARGET_IMGREF=ghcr.io/sector-f-labs/sector-f-linux:latest
    177 RUN mkdir -p /usr/lib/patina-install && echo "$PAYLOAD_REF" > /usr/lib/patina-install/payload && \
    178     echo "$TARGET_IMGREF" > /usr/lib/patina-install/target
    179 # For testing only (LIVE_DEBUG=1 in live/build.sh): root can log in over SSH with the test rig's key.
    180 # A real ISO has no SSH access.
    181 ARG DEBUG_SSH_KEY=
    182 RUN if [ -n "$DEBUG_SSH_KEY" ]; then \
    183         mkdir -p /var/roothome/.ssh && echo "$DEBUG_SSH_KEY" > /var/roothome/.ssh/authorized_keys && \
    184         chmod 700 /var/roothome/.ssh && chmod 600 /var/roothome/.ssh/authorized_keys && \
    185         systemctl enable sshd.service; \
    186     else systemctl disable sshd.service 2>/dev/null || true; fi
    187 COPY system/usr/lib/tmpfiles.d/patina-greeter.conf /usr/lib/tmpfiles.d/
    188 COPY system/usr/share/pixmaps/seflos-logo.svg /usr/share/pixmaps/
    189 COPY --from=plymouth-theme /sectorf /usr/share/plymouth/themes/sectorf
    190 RUN mkdir -p /usr/lib/bootc-image-builder
    191 COPY live/iso.yaml /usr/lib/bootc-image-builder/iso.yaml
    192 # The initramfs with what a live boot needs: the squashfs by label (dmsquash-live) and the splash.
    193 RUN printf '[Daemon]\nTheme=sectorf\nShowDelay=0\n' > /etc/plymouth/plymouthd.conf && \
    194     systemctl enable greetd.service && systemctl set-default graphical.target && \
    195     kver=$(ls /usr/lib/modules) && \
    196     DRACUT_NO_XATTR=1 dracut --no-hostonly --kver "$kver" --reproducible --zstd \
    197         --add "dmsquash-live plymouth" -f "/usr/lib/modules/$kver/initramfs.img"
    198