Skip to content

Commit

Permalink
go version updated to 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
nvvfedorov committed Dec 15, 2023
1 parent 7444231 commit edb0609
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ MKDIR ?= mkdir
REGISTRY ?= nvidia

DCGM_VERSION := 3.3.0
GOLANG_VERSION := 1.18
GOLANG_VERSION := 1.21.5
VERSION := 3.2.0
FULL_VERSION := $(DCGM_VERSION)-$(VERSION)
OUTPUT := type=oci,dest=/tmp/dcgm-exporter.tar
Expand Down
30 changes: 29 additions & 1 deletion docker/Dockerfile.ubi8
Original file line number Diff line number Diff line change
@@ -1,6 +1,34 @@
FROM nvcr.io/nvidia/cuda:12.2.2-base-ubi8 AS builder
ARG GOLANG_VERSION
FROM golang:$GOLANG_VERSION AS builder
WORKDIR /go/src/github.com/NVIDIA/dcgm-exporter
RUN set -eux; \
dnf clean expire-cache; \
dnf install -y go-toolset make
RUN dnf clean all

# Install Go official release
RUN set -eux; \
url=; \
arch=$(uname -m) \
&& if [ "${arch}" = "x86_64" ]; then arch=amd64; fi \
&& if [ "${arch}" = "aarch64" ]; then arch=arm64; fi \
&& echo "${arch}"
# case "${arch}" in \
# 'amd64') \
# url="https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.tar.gz"; \
# ;; \
# 'arm64') \
# url="https://dl.google.com/go/go${GOLANG_VERSION}.linux-arm64.tar.gz"; \
# ;; \
# *) echo >&2 "error: unsupported architecture '${arch}'"; exit 1 ;; \
# esac; \
# \
# wget -O go.tgz "$url" --progress=dot:giga; \
# # https://github.com/golang/go/issues/14739#issuecomment-324767697
# tar -C /usr/local -xzf go.tgz; \
# rm -f go.tgz*; \
# \
# go version

COPY . .

Expand Down
45 changes: 42 additions & 3 deletions docker/Dockerfile.ubuntu20.04
Original file line number Diff line number Diff line change
@@ -1,7 +1,46 @@
ARG GOLANG_VERSION
FROM golang:$GOLANG_VERSION AS builder
FROM nvcr.io/nvidia/cuda:12.2.2-base-ubuntu20.04 AS builder
ARG GOLANG_VERSION=1.21.5
WORKDIR /go/src/github.com/NVIDIA/dcgm-exporter

RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
g++ \
gcc \
libc6-dev \
make \
pkg-config \
wget \
; \
rm -rf /var/lib/apt/lists/*
RUN set -eux; \
arch="$(dpkg --print-architecture)"; arch="${arch##*-}"; \
url=; \
case "$arch" in \
'amd64') \
url="https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.tar.gz"; \
;; \
'arm64') \
url="https://dl.google.com/go/go${GOLANG_VERSION}.linux-arm64.tar.gz"; \
;; \
*) echo >&2 "error: unsupported architecture '$arch' (likely packaging update needed)"; exit 1 ;; \
esac; \
build=; \
if [ -z "$url" ]; then \
# https://github.com/golang/go/issues/38536#issuecomment-616897960
build=1; \
url="https://dl.google.com/go/go${GOLANG_VERSION}.src.tar.gz"; \
echo >&2; \
echo >&2 "warning: current architecture ($arch) does not have a compatible Go binary release; will be building from source"; \
echo >&2; \
fi; \
wget -O go.tgz "$url" --progress=dot:giga; \
tar -C /usr/local -xzf go.tgz; \
rm go.tgz;
ENV GOTOOLCHAIN=local
ENV GOPATH /go
ENV PATH $GOPATH/bin:$PATH
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 1777 "$GOPATH"
ENV PATH $PATH:/usr/local/go/bin
COPY . .

RUN make binary check-format
Expand Down

0 comments on commit edb0609

Please sign in to comment.