-
Notifications
You must be signed in to change notification settings - Fork 297
/
Dockerfile
94 lines (76 loc) · 2.99 KB
/
Dockerfile
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
ARG CUDA_SAMPLE_IMAGE=undefined
ARG GOLANG_VERSION=x.x.x
FROM nvcr.io/nvidia/cuda:12.6.2-base-ubi9 as build
RUN dnf install -y wget make git gcc
ARG GOLANG_VERSION=0.0.0
RUN set -eux; \
\
arch="$(uname -m)"; \
case "${arch##*-}" in \
x86_64 | amd64) ARCH='amd64' ;; \
ppc64el | ppc64le) ARCH='ppc64le' ;; \
aarch64 | arm64) ARCH='arm64' ;; \
*) echo "unsupported architecture" ; exit 1 ;; \
esac; \
wget -nv -O - https://storage.googleapis.com/golang/go${GOLANG_VERSION}.linux-${ARCH}.tar.gz \
| tar -C /usr/local -xz
ENV GOPATH /go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
WORKDIR /build
COPY . .
ARG VERSION="unknown"
ARG GIT_COMMIT="unknown"
RUN mkdir /artifacts
RUN make -C validator/ validator
RUN cp /build/validator/validator /artifacts/nvidia-validator
RUN cp /build/validator/plugin-workload-validation.yaml /artifacts/
RUN cp /build/validator/cuda-workload-validation.yaml /artifacts/
FROM ${CUDA_SAMPLE_IMAGE} AS sample-builder
RUN mkdir /artifacts
RUN cp /cuda-samples/vectorAdd /artifacts/vectorAdd
FROM nvcr.io/nvidia/cuda:12.6.2-base-ubi9
# Remove CUDA libs(compat etc) in favor of libs installed by the NVIDIA driver
RUN dnf remove -y cuda-*
RUN dnf install -y \
kmod \
pciutils && \
rm -rf /var/cache/yum/*
RUN mkdir /licenses && mv /NGC-DL-CONTAINER-LICENSE /licenses/NGC-DL-CONTAINER-LICENSE
COPY --from=build /artifacts/nvidia-validator /usr/bin/nvidia-validator
COPY --from=sample-builder /artifacts/vectorAdd /usr/bin/vectorAdd
RUN mkdir -p /var/nvidia/manifests
COPY --from=build /artifacts/plugin-workload-validation.yaml /var/nvidia/manifests
COPY --from=build /artifacts/cuda-workload-validation.yaml /var/nvidia/manifests
ENV NVIDIA_DISABLE_REQUIRE="true"
ENV NVIDIA_VISIBLE_DEVICES=void
ENV NVIDIA_DRIVER_CAPABILITIES=utility,compute
ARG VERSION="unknown"
ARG GIT_COMMIT="unknown"
LABEL version="${VERSION}"
LABEL release="N/A"
LABEL vendor="NVIDIA"
LABEL io.k8s.display-name="NVIDIA Validators for the GPU Operator Components"
LABEL name="NVIDIA Validator for the GPU Operator"
LABEL summary="NVIDIA Validator for the GPU Operator"
LABEL description="See summary"
LABEL vsc-ref=${GIT_COMMIT}
# Install / upgrade packages here that are required to resolve CVEs
ARG CVE_UPDATES
RUN if [ -n "${CVE_UPDATES}" ]; then \
dnf update -y ${CVE_UPDATES} && \
rm -rf /var/cache/yum/*; \
fi
ENTRYPOINT ["/bin/bash"]