Skip to content

Commit 26bff14

Browse files
authored
Merge pull request NVIDIA#460 from NVIDIA/vgpu-util-optional
only build vgpu-util when the DRIVER_TYPE is vgpu
2 parents 440be0c + 9c5ed9e commit 26bff14

File tree

3 files changed

+24
-9
lines changed

3 files changed

+24
-9
lines changed

rhel9/Dockerfile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ FROM ${BASE_IMAGE} as build
55
ARG TARGETARCH
66
ARG GOLANG_VERSION
77

8+
# Arg to indicate if driver type is either of passthrough(baremetal) or vgpu
9+
ARG DRIVER_TYPE=passthrough
10+
ENV DRIVER_TYPE=$DRIVER_TYPE
11+
812
SHELL ["/bin/bash", "-c"]
913

1014
RUN dnf install -y git wget
@@ -18,10 +22,11 @@ ENV PATH /usr/local/go/bin:$PATH
1822

1923
WORKDIR /work
2024

21-
RUN git clone https://github.com/NVIDIA/gpu-driver-container driver && \
25+
RUN if [ "$DRIVER_TYPE" = "vgpu" ]; then \
26+
git clone https://github.com/NVIDIA/gpu-driver-container driver && \
2227
cd driver/vgpu/src && \
2328
go build -o vgpu-util && \
24-
mv vgpu-util /work
29+
mv vgpu-util /work; fi
2530

2631
FROM nvcr.io/nvidia/cuda:13.0.1-base-ubi9
2732

@@ -78,7 +83,7 @@ COPY nvidia-driver /usr/local/bin
7883
COPY ocp_dtk_entrypoint /usr/local/bin
7984
COPY common.sh /usr/local/bin
8085

81-
COPY --from=build /work/vgpu-util /usr/local/bin
86+
COPY --from=build /work/vgpu-util* /usr/local/bin
8287

8388
WORKDIR /drivers
8489

ubuntu22.04/Dockerfile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ FROM nvcr.io/nvidia/cuda:13.0.1-base-ubuntu22.04 as build
33
ARG TARGETARCH
44
ARG GOLANG_VERSION
55

6+
# Arg to indicate if driver type is either of passthrough(baremetal) or vgpu
7+
ARG DRIVER_TYPE=passthrough
8+
ENV DRIVER_TYPE=$DRIVER_TYPE
9+
610
SHELL ["/bin/bash", "-c"]
711

812
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
@@ -27,10 +31,11 @@ ENV PATH /usr/local/go/bin:$PATH
2731

2832
WORKDIR /work
2933

30-
RUN git clone https://github.com/NVIDIA/gpu-driver-container driver && \
34+
RUN if [ "$DRIVER_TYPE" = "vgpu" ]; then \
35+
git clone https://github.com/NVIDIA/gpu-driver-container driver && \
3136
cd driver/vgpu/src && \
3237
go build -o vgpu-util && \
33-
mv vgpu-util /work
38+
mv vgpu-util /work; fi
3439

3540
FROM nvcr.io/nvidia/cuda:13.0.1-base-ubuntu22.04
3641

@@ -71,7 +76,7 @@ RUN /tmp/install.sh reposetup && /tmp/install.sh depinstall && \
7176

7277
COPY nvidia-driver /usr/local/bin
7378

74-
COPY --from=build /work/vgpu-util /usr/local/bin
79+
COPY --from=build /work/vgpu-util* /usr/local/bin
7580

7681
ADD drivers drivers/
7782

ubuntu24.04/Dockerfile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ FROM ${BASE_IMAGE} as build
55
ARG TARGETARCH
66
ARG GOLANG_VERSION
77

8+
# Arg to indicate if driver type is either of passthrough(baremetal) or vgpu
9+
ARG DRIVER_TYPE=passthrough
10+
ENV DRIVER_TYPE=$DRIVER_TYPE
11+
812
SHELL ["/bin/bash", "-c"]
913

1014
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
@@ -31,10 +35,11 @@ ENV PATH /usr/local/go/bin:$PATH
3135

3236
WORKDIR /work
3337

34-
RUN git clone https://github.com/NVIDIA/gpu-driver-container driver && \
38+
RUN if [ "$DRIVER_TYPE" = "vgpu" ]; then \
39+
git clone https://github.com/NVIDIA/gpu-driver-container driver && \
3540
cd driver/vgpu/src && \
3641
go build -o vgpu-util && \
37-
mv vgpu-util /work
42+
mv vgpu-util /work; fi
3843

3944
FROM ${BASE_IMAGE}
4045

@@ -70,7 +75,7 @@ RUN usermod -o -u 0 -g 0 _apt && \
7075

7176
COPY nvidia-driver /usr/local/bin
7277

73-
COPY --from=build /work/vgpu-util /usr/local/bin
78+
COPY --from=build /work/vgpu-util* /usr/local/bin
7479

7580
ADD drivers drivers/
7681

0 commit comments

Comments
 (0)