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 faf5078
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions deployments/container/Dockerfile.ubi8
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,28 @@

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

FROM golang:${GOLANG_VERSION} AS build

WORKDIR /work
FROM nvcr.io/nvidia/cuda:${CUDA_VERSION}-base-${BASE_DIST}

COPY go.mod go.mod
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 /usr/local/bin/nvdrain ./cmd/nvdrain

ARG TARGETARCH

Expand All @@ -39,7 +47,6 @@ 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

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 faf5078

Please sign in to comment.