diff --git a/deployments/container/Dockerfile.ubi8 b/deployments/container/Dockerfile.ubi8 index fc5e3ebd..f4a52357 100644 --- a/deployments/container/Dockerfile.ubi8 +++ b/deployments/container/Dockerfile.ubi8 @@ -14,20 +14,33 @@ 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 +RUN dnf install -y wget make git gcc + +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 + +ENV GOPATH /go +ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH -FROM nvidia/cuda:${CUDA_VERSION}-base-${BASE_DIST} +RUN GOOS=linux go build -o /usr/local/bin/nvdrain ./cmd/nvdrain ARG TARGETARCH @@ -39,7 +52,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"