-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathContainerfile.nvidia
39 lines (32 loc) · 1.87 KB
/
Containerfile.nvidia
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
ARG BASE_IMAGE="${BASE_IMAGE:-ghcr.io/trgeiger/quark}"
ARG IMAGE_NAME="${IMAGE_NAME:-quark-open}"
ARG BASE_IMAGE_NAME="${BASE_IMAGE_NAME:-silverblue}"
ARG QUARK_VERSION="${QUARK_VERSION:-41}"
ARG KMOD_IMAGE_VERSION="${KMOD_IMAGE_VERSION:-41}"
ARG NVIDIA_MODULE_TYPE="${NVIDIA_MODULE_TYPE:-nvidia-open}"
ARG NVIDIA_VERSION="${NVIDIA_VERSION:-stable}"
FROM ghcr.io/trgeiger/nvidia-kmod-${NVIDIA_MODULE_TYPE}:${KMOD_IMAGE_VERSION}-${NVIDIA_VERSION} AS nvidia-akmods
FROM ${BASE_IMAGE}:${QUARK_VERSION} AS quark
ARG IMAGE_NAME="${IMAGE_NAME:-quark-open}"
ARG IMAGE_VENDOR="${IMAGE_VENDOR}"
ARG IMAGE_BRANCH="${IMAGE_BRANCH:-main}"
ARG BASE_IMAGE_NAME="${BASE_IMAGE_NAME:-silverblue}"
ARG QUARK_VERSION="${QUARK_VERSION:-41}"
ARG NVIDIA_VERSION="${NVIDIA_VERSION:-stable}"
ARG USE_PERSONAL_REPO="${USE_PERSONAL_REPO:-false}"
COPY tmp /tmp
COPY install-nvidia.sh /tmp/
RUN install -Dm644 tmp/private_key.priv /etc/pki/akmods/private/private_key.priv && \
install -Dm644 /etc/pki/akmods/certs/quark-secure-boot.der /etc/pki/akmods/certs/public_key.der
RUN --mount=type=cache,dst=/var/cache/rpm-ostree \
--mount=type=bind,from=nvidia-akmods,src=/rpms,dst=/tmp/akmods-rpms \
/tmp/install-nvidia.sh "${IMAGE_NAME}" "${NVIDIA_VERSION}" "${USE_PERSONAL_REPO}" && \
KERNEL_VERSION="$(rpm -q kernel-cachyos-lts --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')" && \
modinfo -l /usr/lib/modules/${KERNEL_VERSION}/extra/nvidia/nvidia{,-drm,-modeset,-peermem,-uvm}.ko.xz && \
rm -f /usr/share/vulkan/icd.d/nouveau_icd.*.json && \
echo 'force_drivers+=" nvidia nvidia-drm nvidia-modeset nvidia-peermem nvidia-uvm "' > /usr/lib/dracut/dracut.conf.d/95-nvidia.conf
RUN rm -f /etc/pki/akmods/private/private_key.priv && \
rm -f /etc/pki/akmods/certs/public_key.der && \
/usr/libexec/containerbuild/build-initramfs && \
/usr/libexec/containerbuild/cleanup.sh && \
ostree container commit