Skip to content

Commit c98f6ea

Browse files
committed
Update containerized docker files for golang 1.20.5
Signed-off-by: Evan Lezar <elezar@nvidia.com>
1 parent 073f9cf commit c98f6ea

File tree

2 files changed

+45
-16
lines changed

2 files changed

+45
-16
lines changed

build/container/Dockerfile.centos

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,29 @@ ARG CUDA_VERSION
1717
ARG GOLANG_VERSION=x.x.x
1818
ARG 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

2944
WORKDIR /build
3045
COPY . .

build/container/Dockerfile.ubuntu

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,28 @@ ARG CUDA_VERSION
1717
ARG GOLANG_VERSION=x.x.x
1818
ARG 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

2943
WORKDIR /build
3044
COPY . .

0 commit comments

Comments
 (0)