File tree Expand file tree Collapse file tree 2 files changed +45
-16
lines changed Expand file tree Collapse file tree 2 files changed +45
-16
lines changed Original file line number Diff line number Diff line change @@ -17,14 +17,29 @@ ARG CUDA_VERSION
1717ARG GOLANG_VERSION=x.x.x
1818ARG VERSION="N/A"
1919
20- # NOTE: In cases where the libc version is a concern, we would have to use an
21- # image based on the target OS to build the golang executables here -- especially
22- # if cgo code is included.
23- FROM golang:${GOLANG_VERSION} as build
24-
25- # We override the GOPATH to ensure that the binaries are installed to
26- # /artifacts/bin
27- ARG GOPATH=/artifacts
20+ FROM nvidia/cuda:${CUDA_VERSION}-base-${BASE_DIST} as build
21+
22+ RUN yum install -y \
23+ wget make git gcc \
24+ && \
25+ rm -rf /var/cache/yum/*
26+
27+ ARG GOLANG_VERSION=x.x.x
28+ RUN set -eux; \
29+ \
30+ arch="$(uname -m)"; \
31+ case "${arch##*-}" in \
32+ x86_64 | amd64) ARCH='amd64' ;; \
33+ ppc64el | ppc64le) ARCH='ppc64le' ;; \
34+ aarch64) ARCH='arm64' ;; \
35+ *) echo "unsupported architecture" ; exit 1 ;; \
36+ esac; \
37+ wget -nv -O - https://storage.googleapis.com/golang/go${GOLANG_VERSION}.linux-${ARCH}.tar.gz \
38+ | tar -C /usr/local -xz
39+
40+
41+ ENV GOPATH /go
42+ ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
2843
2944WORKDIR /build
3045COPY . .
Original file line number Diff line number Diff line change @@ -17,14 +17,28 @@ ARG CUDA_VERSION
1717ARG GOLANG_VERSION=x.x.x
1818ARG VERSION="N/A"
1919
20- # NOTE: In cases where the libc version is a concern, we would have to use an
21- # image based on the target OS to build the golang executables here -- especially
22- # if cgo code is included.
23- FROM golang:${GOLANG_VERSION} as build
24-
25- # We override the GOPATH to ensure that the binaries are installed to
26- # /artifacts/bin
27- ARG GOPATH=/artifacts
20+ FROM nvidia/cuda:${CUDA_VERSION}-base-${BASE_DIST} as build
21+
22+ RUN apt-get update && \
23+ apt-get install -y wget make git gcc \
24+ && \
25+ rm -rf /var/lib/apt/lists/*
26+
27+ ARG GOLANG_VERSION=x.x.x
28+ RUN set -eux; \
29+ \
30+ arch="$(uname -m)"; \
31+ case "${arch##*-}" in \
32+ x86_64 | amd64) ARCH='amd64' ;; \
33+ ppc64el | ppc64le) ARCH='ppc64le' ;; \
34+ aarch64) ARCH='arm64' ;; \
35+ *) echo "unsupported architecture" ; exit 1 ;; \
36+ esac; \
37+ wget -nv -O - https://storage.googleapis.com/golang/go${GOLANG_VERSION}.linux-${ARCH}.tar.gz \
38+ | tar -C /usr/local -xz
39+
40+ ENV GOPATH /go
41+ ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
2842
2943WORKDIR /build
3044COPY . .
You can’t perform that action at this time.
0 commit comments