Skip to content

Commit 28ddc14

Browse files
committed
Switch to golang distroless image
Signed-off-by: Evan Lezar <elezar@nvidia.com>
1 parent d9c7ec9 commit 28ddc14

File tree

1 file changed

+23
-9
lines changed

1 file changed

+23
-9
lines changed

deployments/container/Dockerfile

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,18 @@ ARG VERSION="N/A"
4848
ARG GIT_COMMIT="unknown"
4949
RUN make PREFIX=/artifacts/bin cmd-nvidia-ctk-installer
5050

51-
# The packaging stage collects the deb and rpm packages built for supported
52-
# architectures.
53-
FROM nvcr.io/nvidia/cuda:12.9.0-base-ubi9 AS packaging
51+
# The packaging stage collects the deb and rpm packages built for
52+
# supported architectures.
53+
FROM nvcr.io/nvidia/distroless/go:v3.1.9-dev AS packaging
54+
55+
USER 0:0
56+
SHELL ["/busybox/sh", "-c"]
57+
RUN ln -s /busybox/sh /bin/sh
5458

5559
ARG ARTIFACTS_ROOT
5660
COPY ${ARTIFACTS_ROOT} /artifacts/packages/
5761

58-
WORKDIR /artifacts/packages
62+
WORKDIR /artifacts
5963

6064
# build-args are added to the manifest.txt file below.
6165
ARG PACKAGE_VERSION
@@ -70,7 +74,12 @@ RUN echo "#IMAGE_EPOCH=$(date '+%s')" > /artifacts/manifest.txt && \
7074
env | sed 's/^/#/g' >> /artifacts/manifest.txt && \
7175
find /artifacts/packages -iname '*.deb' -o -iname '*.rpm' >> /artifacts/manifest.txt
7276

73-
RUN mkdir /licenses && mv /NGC-DL-CONTAINER-LICENSE /licenses/NGC-DL-CONTAINER-LICENSE
77+
LABEL name="NVIDIA Container Toolkit Packages"
78+
LABEL vendor="NVIDIA"
79+
LABEL version="${VERSION}"
80+
LABEL release="N/A"
81+
LABEL summary="deb and rpm packages for the NVIDIA Container Toolkit"
82+
LABEL description="See summary"
7483

7584
# The debpackages stage is used to extract the contents of deb packages.
7685
FROM nvcr.io/nvidia/cuda:12.9.0-base-ubuntu20.04 AS debpackages
@@ -116,13 +125,19 @@ RUN set -eux; \
116125
# - The extracted deb packages
117126
# - The extracted rpm packages
118127
# - The nvidia-ctk-installer binary
119-
FROM nvcr.io/nvidia/cuda:12.9.0-base-ubi9 AS artifacts
128+
FROM scratch AS artifacts
120129

121130
COPY --from=rpmpackages /artifacts/rpm /artifacts/rpm
122131
COPY --from=debpackages /artifacts/deb /artifacts/deb
123132
COPY --from=build /artifacts/bin /artifacts/build
124133

125-
FROM nvcr.io/nvidia/cuda:12.9.0-base-ubi9
134+
# The application stage contains the application used as a GPU Operator
135+
# operand.
136+
FROM nvcr.io/nvidia/distroless/go:v3.1.9-dev AS application
137+
138+
USER 0:0
139+
SHELL ["/busybox/sh", "-c"]
140+
RUN ln -s /busybox/sh /bin/sh
126141

127142
ENV NVIDIA_DISABLE_REQUIRE="true"
128143
ENV NVIDIA_VISIBLE_DEVICES=void
@@ -131,6 +146,7 @@ ENV NVIDIA_DRIVER_CAPABILITIES=utility
131146
COPY --from=artifacts /artifacts/rpm /artifacts/rpm
132147
COPY --from=artifacts /artifacts/deb /artifacts/deb
133148
COPY --from=artifacts /artifacts/build /work
149+
COPY --from=artifacts /NGC-DL-CONTAINER-LICENSE /licenses/NGC-DL-CONTAINER-LICENSE
134150

135151
WORKDIR /work
136152
ENV PATH=/work:$PATH
@@ -144,6 +160,4 @@ LABEL release="N/A"
144160
LABEL summary="Automatically Configure your Container Runtime for GPU support."
145161
LABEL description="See summary"
146162

147-
RUN mkdir /licenses && mv /NGC-DL-CONTAINER-LICENSE /licenses/NGC-DL-CONTAINER-LICENSE
148-
149163
ENTRYPOINT ["/work/nvidia-ctk-installer"]

0 commit comments

Comments
 (0)