Adding nvidia support to supermicro image

This commit is contained in:
Ben Radey
2026-01-16 13:43:58 -05:00
parent a675af509e
commit 90df30e6a8
+20 -3
View File
@@ -21,9 +21,13 @@ RUN rpm --import \
/keys/OpenZFS \
/keys/Smallstep \
/keys/zrepl-rpm-pkgs \
/keys/RPM-GPG-KEY-rpmfusion-free-fedora-2020 \
/keys/RPM-GPG-KEY-rpmfusion-nonfree-fedora-2020 \
/etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-43-x86_64 && \
rm -rf /keys && \
dnf5 install -y https://github.com/zfsonlinux/zfsonlinux.github.com/raw/master/fedora/zfs-release-3-0$(rpm --eval "%{dist}").noarch.rpm && \
dnf5 install -y https://github.com/zfsonlinux/zfsonlinux.github.com/raw/master/fedora/zfs-release-3-0$(rpm --eval "%{dist}").noarch.rpm \
https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm \
https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm && \
dnf5 install -y \
kernel-devel kernel-devel-matched kernel-headers kernel-srpm-macros && \
dnf5 install -y zfs && \
@@ -34,6 +38,7 @@ RUN rpm --import \
COPY supermicro-x10drh/*.repo /etc/yum.repos.d/
RUN dnf5 install -y \
akmods \
ansible \
borgbackup \
certbot \
@@ -67,14 +72,26 @@ RUN dnf5 install -y \
zrepl-v0.6.0-1.x86_64 && \
dnf5 clean all
# TODO: Remove this `|| true` hack once post scriptlets no longer make dnf exit with non-zero
RUN dnf5 install -y \
akmod-nvidia || true && \
dnf5 clean all
# TODO: Remove these unnecessary checks to make sure the packages above actually got installed. rpm exits non-zero if the package is not installed and aborts the Containerfile build
RUN rpm -q akmod-nvidia
# Build nvidia akmod with no special arguments - defaults to open kernel driver for newer hardware
RUN mkdir -p /var/log/akmods /var/cache/akmods/nvidia /var/tmp && \
chmod 777 /var/tmp && \
/usr/sbin/akmods --force --kernels "$(rpm -qa kernel --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')"
# Cleanup image for linting
RUN test -f /usr/lib/sysusers.d/libvirt.conf || echo -e 'g libvirt 963' > /usr/lib/sysusers.d/libvirt.conf && \
test -f /usr/lib/sysusers.d/qat.conf || echo -e 'g qat 995' > /usr/lib/sysusers.d/qat.conf
# The first check makes sure that we have exactly 4 gpg pubkeys trusted in the rpmdb (the ones from the base image).
# The first check makes sure that we have exactly 6 gpg pubkeys trusted in the rpmdb (the ones from the base image).
# Any more than that means that dnf automatically added a new one, which is shady!
# Then: cleanup image for linting
# Finally: verify image is good
RUN [[ 4 -eq $(rpm -qa gpg-pubkey* | wc -l) ]] && \
RUN [[ 6 -eq $(rpm -qa gpg-pubkey* | wc -l) ]] && \
rm -rf /var /boot && mkdir /var /boot && \
bootc container lint --fatal-warnings --skip baseimage-composefs