Skip to content

Commit d648c11

Browse files
committed
e2e test
1 parent 9657560 commit d648c11

File tree

6 files changed

+934
-0
lines changed

6 files changed

+934
-0
lines changed

amzn2023/Dockerfile

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
ARG CUDA_VERSION=latest
2+
3+
FROM nvcr.io/nvidia/cuda:${CUDA_VERSION}-base-amzn2023 AS build
4+
FROM amazonlinux:2
5+
6+
ARG TARGETARCH
7+
ARG CUDA_VERSION
8+
9+
SHELL ["/bin/bash", "-c"]
10+
11+
# Remove cuda repository to avoid GPG errors
12+
RUN rm -f /etc/yum.repos.d/cuda*
13+
14+
RUN yum update -y && yum install -y yum-utils && \
15+
yum-config-manager --setopt=skip_missing_names_on_install=False && \
16+
yum install -y \
17+
gcc \
18+
gcc-c++ \
19+
make \
20+
ca-certificates \
21+
git -y && \
22+
yum clean all
23+
24+
ENV GOLANG_VERSION=1.23.1
25+
26+
# download appropriate binary based on the target architecture for multi-arch builds
27+
RUN OS_ARCH=$(echo ${TARGETARCH} | sed 's/x86_64/amd64/' ) && \
28+
curl -s https://storage.googleapis.com/golang/go${GOLANG_VERSION}.linux-${OS_ARCH}.tar.gz \
29+
| tar -C /usr/local -xz
30+
31+
ENV PATH /usr/local/go/bin:$PATH
32+
33+
WORKDIR /work
34+
35+
RUN git clone https://github.com/NVIDIA/gpu-driver-container driver && \
36+
cd driver/vgpu/src && \
37+
go build -o vgpu-util && \
38+
mv vgpu-util /work
39+
COPY --from=build /work/vgpu-util /usr/local/bin
40+
41+
FROM nvcr.io/nvidia/cuda:${CUDA_VERSION}-base-amzn2023
42+
43+
SHELL ["/bin/bash", "-c"]
44+
45+
ARG BASE_URL=https://us.download.nvidia.com/tesla
46+
ARG TARGETARCH
47+
ENV TARGETARCH=$TARGETARCH
48+
ARG DRIVER_VERSION
49+
ENV DRIVER_VERSION=$DRIVER_VERSION
50+
51+
# Arg to indicate if driver type is either of passthrough(baremetal) or vgpu
52+
ARG DRIVER_TYPE=passthrough
53+
ENV DRIVER_TYPE=$DRIVER_TYPE
54+
ARG DRIVER_BRANCH=550
55+
ENV DRIVER_BRANCH=$DRIVER_BRANCH
56+
ARG VGPU_LICENSE_SERVER_TYPE=NLS
57+
ENV VGPU_LICENSE_SERVER_TYPE=$VGPU_LICENSE_SERVER_TYPE
58+
# Enable vGPU version compability check by default
59+
ARG DISABLE_VGPU_VERSION_CHECK=true
60+
ENV DISABLE_VGPU_VERSION_CHECK=$DISABLE_VGPU_VERSION_CHECK
61+
ENV NVIDIA_VISIBLE_DEVICES=void
62+
63+
RUN echo "TARGETARCH=$TARGETARCH"
64+
65+
ADD install.sh /tmp
66+
67+
RUN /tmp/install.sh reposetup && /tmp/install.sh depinstall && \
68+
curl -fsSL -o /usr/local/bin/donkey https://github.com/3XX0/donkey/releases/download/v1.1.0/donkey && \
69+
chmod +x /usr/local/bin/donkey
70+
71+
COPY nvidia-driver /usr/local/bin
72+
73+
ADD drivers drivers/
74+
75+
# Fetch the installer automatically for passthrough/baremetal types
76+
RUN if [ "$DRIVER_TYPE" != "vgpu" ]; then \
77+
cd drivers && \
78+
/tmp/install.sh download_installer; fi
79+
80+
RUN if [ "$DRIVER_TYPE" != "vgpu" ] && [ "$TARGETARCH" != "arm64" ]; then \
81+
yum update -y && \
82+
yum install -y \
83+
nvidia-fabric-manager-${DRIVER_VERSION}-1 \
84+
libnvidia-nscq-${DRIVER_BRANCH}-${DRIVER_VERSION}-1; fi
85+
86+
WORKDIR /drivers
87+
88+
ARG PUBLIC_KEY=empty
89+
COPY ${PUBLIC_KEY} kernel/pubkey.x509
90+
91+
# Install / upgrade packages here that are required to resolve CVEs
92+
ARG CVE_UPDATES
93+
RUN if [ -n "${CVE_UPDATES}" ]; then \
94+
yum update -y && yum install -y yum-utils && \
95+
yum-config-manager --setopt=skip_missing_names_on_install=False && \
96+
yum install -y \
97+
${CVE_UPDATES} && \
98+
yum clean all; fi
99+
100+
# Remove cuda repository to avoid GPG errors
101+
RUN rm -f /etc/yum.repos.d/cuda*
102+
103+
# Add NGC DL license from the CUDA image
104+
RUN mkdir /licenses && mv /NGC-DL-CONTAINER-LICENSE /licenses/NGC-DL-CONTAINER-LICENSE
105+
106+
ENTRYPOINT ["nvidia-driver", "init"]

amzn2023/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# AmazonLinux2 [![build status](https://gitlab.com/nvidia/driver/badges/master/build.svg)](https://gitlab.com/nvidia/driver/commits/master)
2+
3+
See https://github.com/NVIDIA/nvidia-docker/wiki/Driver-containers-(Beta)

amzn2023/drivers/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Folder for downloading vGPU drivers and dependent metadata files

amzn2023/empty

Whitespace-only changes.

amzn2023/install.sh

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
#!/usr/bin/env bash
2+
3+
set -eu
4+
5+
download_installer () {
6+
DRIVER_ARCH=${TARGETARCH/amd64/x86_64} && curl -fSsl -O $BASE_URL/$DRIVER_VERSION/NVIDIA-Linux-$DRIVER_ARCH-$DRIVER_VERSION.run && \
7+
chmod +x NVIDIA-Linux-$DRIVER_ARCH-$DRIVER_VERSION.run;
8+
}
9+
10+
dep_install () {
11+
if [ "$TARGETARCH" = "amd64" ]; then
12+
yum update -y && yum install -y \
13+
yum-utils \
14+
gcc \
15+
make \
16+
glibc-devel \
17+
ca-certificates \
18+
kmod \
19+
file \
20+
elfutils-libelf-devel \
21+
libglvnd-devel \
22+
shadow-utils \
23+
pkgconfig && \
24+
yum clean all
25+
fi
26+
}
27+
28+
repo_setup () {
29+
if [ "$TARGETARCH" = "amd64" ]; then
30+
31+
yum update -y --skip-broken && \
32+
yum install -y shadow-utils dnf-utils --skip-broken
33+
34+
echo "[main]
35+
name=Main Repository
36+
baseurl=https://developer.download.nvidia.com/compute/cuda/repos/amzn2023/x86_64
37+
gpgcheck=1
38+
enabled=1
39+
gpgkey=https://developer.download.nvidia.com/compute/cuda/repos/amzn2023/x86_64/D42D0685.pub" > /etc/yum.repos.d/main.repo && \
40+
41+
# Updates Repository
42+
echo "[updates]
43+
name=Updates Repository
44+
baseurl=https://developer.download.nvidia.com/compute/cuda/repos/amzn2023/x86_64
45+
gpgcheck=1
46+
enabled=1
47+
gpgkey=https://developer.download.nvidia.com/compute/cuda/repos/amzn2023/x86_64/D42D0685.pub" > /etc/yum.repos.d/updates.repo && \
48+
49+
# Security Repository
50+
echo "[security]
51+
name=Security Repository
52+
baseurl=https://developer.download.nvidia.com/compute/cuda/repos/amzn2023/x86_64
53+
gpgcheck=1
54+
enabled=1
55+
gpgkey=gpgkey=https://developer.download.nvidia.com/compute/cuda/repos/amzn2023/x86_64/D42D0685.pub" > /etc/yum.repos.d/security.repo && \
56+
57+
usermod -o -u 0 -g 0 nobody
58+
yum clean all && yum makecache
59+
else
60+
echo "TARGETARCH doesn't match a known arch target"
61+
exit 1
62+
fi
63+
}
64+
65+
nvswitch_dep_installer() {
66+
version_array=(${DRIVER_VERSION//./ })
67+
DRIVER_BRANCH=${version_array[0]}
68+
if [ ${version_array[0]} -ge 470 ] || ([ ${version_array[0]} == 460 ] && [ ${version_array[1]} -ge 91 ]); then
69+
fm_pkg=nvidia-fabric-manager-${DRIVER_VERSION}-1
70+
else \
71+
fm_pkg=nvidia-fabricmanager-${DRIVER_BRANCH}-${DRIVER_VERSION}-1
72+
fi; \
73+
nscq_pkg=libnvidia-nscq-${DRIVER_BRANCH}-${DRIVER_VERSION}-1
74+
yum install -y \
75+
${fm_pkg} \
76+
${nscq_pkg}
77+
rm -rf /var/cache/yum/*
78+
}
79+
80+
if [ "$1" = "reposetup" ]; then
81+
repo_setup
82+
elif [ "$1" = "depinstall" ]; then
83+
dep_install
84+
elif [ "$1" = "download_installer" ]; then
85+
download_installer
86+
elif [ "$1" = "nvswitch_depinstall" ]; then
87+
nvswitch_dep_installer
88+
else
89+
echo "Unknown function: $1"
90+
exit 1
91+
fi
92+

0 commit comments

Comments
 (0)