Split into steps
This commit is contained in:
parent
42cbb86b11
commit
038b89f177
5 changed files with 86 additions and 14 deletions
|
@ -1,12 +1,28 @@
|
|||
# 1. BUILD ARG
|
||||
ARG FEDORA_MAJOR_VERSION=40
|
||||
|
||||
FROM quay.io/fedora-ostree-desktops/kinoite:${FEDORA_MAJOR_VERSION}
|
||||
|
||||
COPY scripts /tmp/scripts
|
||||
# 2. IMAGES USED TO GET 3RD PARTY CONTENT
|
||||
|
||||
# https://github.com/ublue-os/akmods#kmod-packages
|
||||
COPY --from=ghcr.io/ublue-os/akmods-nvidia-open:main-40 /rpms/ /tmp/rpms
|
||||
FROM ghcr.io/ublue-os/akmods-nvidia-open:main-${FEDORA_MAJOR_VERSION} AS akmods-nvidia
|
||||
|
||||
RUN mkdir -p /var/lib/alternatives && \
|
||||
/tmp/scripts/build.sh && \
|
||||
FROM scratch AS base-scripts
|
||||
|
||||
COPY scripts /scripts
|
||||
|
||||
# 3. BUILD COMMON BASE IMAGE
|
||||
FROM quay.io/fedora-ostree-desktops/kinoite:${FEDORA_MAJOR_VERSION} AS base
|
||||
|
||||
RUN --mount=type=bind,from=base-scripts,src=/scripts,dst=/tmp/scripts \
|
||||
mkdir -p /var/lib/alternatives && \
|
||||
/tmp/scripts/install_rpm_fusion.sh && \
|
||||
ostree container commit
|
||||
|
||||
# 4. BUILD NVIDIA VARIANT IMAGE
|
||||
FROM base AS nvidia
|
||||
|
||||
RUN --mount=type=bind,from=akmods-nvidia,src=/rpms,dst=/tmp/akmods-rpms \
|
||||
--mount=type=bind,from=base-scripts,src=/scripts,dst=/tmp/scripts \
|
||||
mkdir -p /var/lib/alternatives && \
|
||||
/tmp/scripts/install_nvidia.sh && \
|
||||
ostree container commit
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
#!/bin/bash
|
||||
set -ouex pipefail
|
||||
|
||||
export RELEASE="$(rpm -E %fedora)"
|
||||
|
||||
/tmp/scripts/nvidia/install.sh
|
52
scripts/install_nvidia.sh
Executable file
52
scripts/install_nvidia.sh
Executable file
|
@ -0,0 +1,52 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -ouex pipefail
|
||||
|
||||
RELEASE="$(rpm -E %fedora)"
|
||||
|
||||
# disable any remaining rpmfusion repos
|
||||
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/rpmfusion*.repo
|
||||
|
||||
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/fedora-cisco-openh264.repo
|
||||
|
||||
## nvidia install steps
|
||||
rpm-ostree install /tmp/akmods-rpms/ublue-os/ublue-os-nvidia-addons-*.rpm
|
||||
|
||||
# enables nvidia repos provided by ublue-os-nvidia-addons
|
||||
sed -i '0,/enabled=0/{s/enabled=0/enabled=1/}' /etc/yum.repos.d/nvidia-container-toolkit.repo
|
||||
|
||||
source /tmp/akmods-rpms/kmods/nvidia-vars
|
||||
|
||||
rpm-ostree install \
|
||||
libnvidia-fbc \
|
||||
libnvidia-ml.i686 \
|
||||
libva-nvidia-driver \
|
||||
mesa-vulkan-drivers.i686 \
|
||||
nvidia-driver \
|
||||
nvidia-driver-cuda \
|
||||
nvidia-driver-cuda-libs.i686 \
|
||||
nvidia-driver-libs.i686 \
|
||||
nvidia-modprobe \
|
||||
nvidia-persistenced \
|
||||
nvidia-settings \
|
||||
nvidia-container-toolkit \
|
||||
/tmp/akmods-rpms/kmods/kmod-nvidia-${KERNEL_VERSION}-${NVIDIA_AKMOD_VERSION}.fc${RELEASE}.rpm
|
||||
|
||||
|
||||
## nvidia post-install steps
|
||||
# disables nvidia repos provided by ublue-os-nvidia-addons
|
||||
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/{eyecantcu-supergfxctl,negativo17-fedora-nvidia,nvidia-container-toolkit}.repo
|
||||
|
||||
# ensure kernel.conf matches NVIDIA_FLAVOR (which must be nvidia or nvidia-open)
|
||||
# kmod-nvidia-common defaults to 'nvidia-open' but this will match our akmod image
|
||||
sed -i "s/^MODULE_VARIANT=.*/MODULE_VARIANT=$KERNEL_MODULE_TYPE/" /etc/nvidia/kernel.conf
|
||||
|
||||
systemctl enable nvidia-persistenced.service
|
||||
|
||||
systemctl enable ublue-nvctk-cdi.service
|
||||
semodule --verbose --install /usr/share/selinux/packages/nvidia-container.pp
|
||||
|
||||
# Universal Blue specific Initramfs fixes
|
||||
echo "options nvidia NVreg_TemporaryFilePath=/var/tmp" >> /usr/lib/modprobe.d/nvidia-atomic.conf
|
||||
cp /etc/modprobe.d/nvidia-modeset.conf /usr/lib/modprobe.d/nvidia-modeset.conf
|
||||
sed -i 's@omit_drivers@force_drivers@g' /usr/lib/dracut/dracut.conf.d/99-nvidia.conf
|
8
scripts/install_rpm_fusion.sh
Executable file
8
scripts/install_rpm_fusion.sh
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -ouex pipefail
|
||||
|
||||
RELEASE="$(rpm -E %fedora)"
|
||||
|
||||
rpm-ostree install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$RELEASE.noarch.rpm \
|
||||
https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$RELEASE.noarch.rpm
|
|
@ -10,6 +10,8 @@ rpm-ostree install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-rele
|
|||
rpm-ostree install /tmp/rpms/ublue-os/ublue-os-nvidia*.rpm
|
||||
rpm-ostree install /tmp/rpms/kmods/kmod-nvidia*.rpm
|
||||
rpm-ostree install xorg-x11-drv-nvidia-cuda libva-nvidia-driver \
|
||||
nvidia-vaapi-driver libva-utils vdpauinfo
|
||||
nvidia-vaapi-driver libva-utils vdpauinfo nvidia-modprobe \
|
||||
nvidia-container-toolkit
|
||||
|
||||
cp /tmp/scripts/nvidia/modprobe.d/*.conf /usr/lib/modprobe.d/
|
||||
cp /tmp/scripts/nvidia/modprobe.d/*.conf /usr/lib/modprobe.d/
|
||||
cp /tmp/scripts/nvidia/modprobe.d/nvidia-modeset.conf /etc/modprobe.d/
|
Loading…
Reference in a new issue