diff --git a/nvidia/Containerfile b/nvidia/Containerfile new file mode 100644 index 0000000..c83e3e9 --- /dev/null +++ b/nvidia/Containerfile @@ -0,0 +1,25 @@ +ARG COREOS_VERSION="${COREOS_VERSION:-stable}" +ARG IMAGE_NAME="${IMAGE_NAME:-ucore}" +ARG PR_PREFIX="${PR_PREFIX}" +ARG ZFS_TAG="${ZFS_TAG}" + +FROM ghcr.io/ublue-os/${IMAGE_NAME}:${PR_PREFIX}${COREOS_VERSION}${ZFS_TAG} + +ARG COREOS_VERSION="${COREOS_VERSION:-stable}" +ARG IMAGE_NAME="${IMAGE_NAME:-ucore}" +ARG NVIDIA_MAJOR_VERSION="${NVIDIA_MAJOR_VERSION:-535}" + +ADD build.sh /tmp/build.sh + +COPY --from=ghcr.io/ublue-os/ucore-kmods:${COREOS_VERSION} /rpms/kmods/nvidia/ublue*.rpm /tmp/rpms/ +COPY --from=ghcr.io/ublue-os/ucore-kmods:${COREOS_VERSION} /rpms/kmods/nvidia/${NVIDIA_MAJOR_VERSION} /tmp/rpms/ + +RUN mkdir -p /var/lib/alternatives \ + && /tmp/build.sh \ + && mv /var/lib/alternatives /staged-alternatives \ + && rm -fr /tmp/* /var/* \ + && rpm-ostree cleanup -m \ + && ostree container commit \ + && mkdir -p /var/lib && mv /staged-alternatives /var/lib/alternatives \ + && mkdir -p /tmp /var/tmp \ + && chmod -R 1777 /tmp /var/tmp \ No newline at end of file diff --git a/nvidia/build.sh b/nvidia/build.sh new file mode 100755 index 0000000..2f50edb --- /dev/null +++ b/nvidia/build.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +set -ouex pipefail + +find /tmp/rpms + +rpm-ostree install /tmp/rpms/ublue-os-ucore-nvidia-*.rpm +sed -i '0,/enabled=0/{s/enabled=0/enabled=1/}' /etc/yum.repos.d/nvidia-container-runtime.repo + +source /tmp/rpms/nvidia-vars + +rpm-ostree install \ + xorg-x11-drv-${NVIDIA_PACKAGE_NAME}-{,cuda-,devel-,kmodsrc-,power-}${NVIDIA_FULL_VERSION} \ + nvidia-container-toolkit \ + /tmp/rpms/kmod-${NVIDIA_PACKAGE_NAME}-${KERNEL_VERSION}-${NVIDIA_AKMOD_VERSION}.fc${RELEASE}.rpm