-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathDockerfile.ubuntu
77 lines (65 loc) · 2.58 KB
/
Dockerfile.ubuntu
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
# Copyright (c) 2019-2025, 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 GOLANG_VERSION=1.23.1
ARG CUDA_IMAGE=cuda
ARG CUDA_VERSION=11.8.0
ARG BASE_DIST=ubuntu20.04
FROM --platform=${BUILDOS}/amd64 nvcr.io/nvidia/cuda:${CUDA_VERSION}-base-${BASE_DIST} as build
RUN apt-get update && \
apt-get install -y wget make git gcc-aarch64-linux-gnu gcc \
&& \
rm -rf /var/lib/apt/lists/*
ARG GOLANG_VERSION=x.x.x
RUN wget -nv -O - https://storage.googleapis.com/golang/go${GOLANG_VERSION}.linux-amd64.tar.gz \
| tar -C /usr/local -xz
ENV GOPATH /go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
WORKDIR /build
COPY . .
ARG TARGETARCH
RUN mkdir /artifacts
ARG VERSION="N/A"
ARG GIT_COMMIT="unknown"
RUN if [ "$TARGETARCH" = "amd64" ]; then \
cc=gcc; \
elif [ "$TARGETARCH" = "arm64" ]; then \
cc=aarch64-linux-gnu-gcc; \
fi && \
make CC=${cc} GOARCH=${TARGETARCH} PREFIX=/artifacts cmds
FROM nvcr.io/nvidia/${CUDA_IMAGE}:${CUDA_VERSION}-base-${BASE_DIST}
ENV NVIDIA_DISABLE_REQUIRE="true"
ENV NVIDIA_VISIBLE_DEVICES=all
ENV NVIDIA_DRIVER_CAPABILITIES=utility
LABEL io.k8s.display-name="NVIDIA DRA Driver"
LABEL name="NVIDIA DRA Driver"
LABEL vendor="NVIDIA"
ARG VERSION="N/A"
ARG GIT_COMMIT="unknown"
LABEL version=${VERSION}
LABEL com.nvidia.git-commit="${GIT_COMMIT}"
LABEL release="N/A"
LABEL summary="NVIDIA DRA driver for Kubernetes"
LABEL description="See summary"
LABEL org.opencontainers.image.description "NVIDIA GPU DRA driver for Kubernetes"
RUN mkdir /licenses && mv /NGC-DL-CONTAINER-LICENSE /licenses/NGC-DL-CONTAINER-LICENSE
COPY --from=build /artifacts/nvidia-dra-controller /usr/bin/nvidia-dra-controller
COPY --from=build /artifacts/nvidia-dra-plugin /usr/bin/nvidia-dra-plugin
COPY --from=build /build/templates /templates
# Install / upgrade packages here that are required to resolve CVEs
ARG CVE_UPDATES
RUN if [ -n "${CVE_UPDATES}" ]; then \
rm -f /etc/apt/sources.list.d/cuda.list && \
apt-get update && apt-get upgrade -y ${CVE_UPDATES} && \
rm -rf /var/lib/apt/lists/*; \
fi