-
Notifications
You must be signed in to change notification settings - Fork 0
/
Containerfile.nvidia
39 lines (37 loc) · 1.68 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 release=38
ARG tag=$release-main
ARG variant=silverblue
FROM ghcr.io/jmpolom/fedora-$variant-ws:$tag as kmod-build
ARG release
RUN rpm -q kernel --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}' > /kernel-version.txt && \
rpm-ostree install -y https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$release.noarch.rpm \
https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$release.noarch.rpm && \
rpm-ostree install -y \
kernel-modules-"$(cat /kernel-version.txt)" \
kernel-devel-"$(cat /kernel-version.txt)" \
akmod-nvidia && \
ln -s /usr/bin/ld.bfd /usr/bin/ld && \
mkdir -p /packages /var/tmp && \
useradd -M builder && \
chown builder:builder /packages && \
chmod 777 /var/tmp
USER builder
WORKDIR /packages
RUN akmodsbuild -k "$(cat /kernel-version.txt)" /usr/src/akmods/nvidia-kmod.latest
FROM ghcr.io/jmpolom/fedora-$variant-ws:$tag
ARG release
RUN mkdir /packages
COPY --from=kmod-build /packages/*.rpm /packages
RUN curl -s -L https://nvidia.github.io/libnvidia-container/centos8/libnvidia-container.repo > /etc/yum.repos.d/libnvidia-container.repo && \
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 && \
rpm-ostree install \
/packages/*.rpm \
moby-engine \
nvidia-container-toolkit \
xorg-x11-drv-nvidia-cuda && \
sed -i 's/^#no-cgroups = false/no-cgroups = true/;' /etc/nvidia-container-runtime/config.toml && \
echo 'blacklist nouveau' > /etc/modprobe.d/nouveau-blacklist.conf && \
rm -rf /packages && \
ostree container commit