Skip to content

Commit

Permalink
run go build in the cuda base image rather golang
Browse files Browse the repository at this point in the history
Signed-off-by: Tariq Ibrahim <[email protected]>
  • Loading branch information
tariq1890 committed Mar 14, 2024
1 parent d098058 commit f3b57dc
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions deployments/container/Dockerfile.ubi8
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@

ARG CUDA_VERSION
ARG BASE_DIST
ARG GOLANG_VERSION=x.x.x

FROM golang:${GOLANG_VERSION} AS build
FROM nvcr.io/nvidia/cuda:${CUDA_VERSION}-base-${BASE_DIST}

WORKDIR /work

Expand All @@ -25,9 +24,20 @@ COPY go.sum go.sum
COPY vendor vendor
COPY cmd/nvdrain cmd/nvdrain

RUN GOOS=linux go build -o nvdrain ./cmd/nvdrain
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

FROM nvidia/cuda:${CUDA_VERSION}-base-${BASE_DIST}
RUN GOOS=linux go build -o nvdrain ./cmd/nvdrain

ARG TARGETARCH

Expand All @@ -39,7 +49,7 @@ RUN chmod a+x /usr/bin/kubectl

COPY driver-manager /usr/local/bin
COPY scripts/vfio-manage /usr/local/bin
COPY --from=build /work/nvdrain /usr/local/bin
COPY /work/nvdrain /usr/local/bin

LABEL io.k8s.display-name="NVIDIA Driver Upgrade Manager for Kubernetes"
LABEL name="NVIDIA Driver Upgrade Manager for Kubernetes"
Expand Down

0 comments on commit f3b57dc

Please sign in to comment.