Skip to content

Commit

Permalink
Merge branch 'pin-go-to-1.20.4' into 'main'
Browse files Browse the repository at this point in the history
Use go 1.20.4 to reduce glibc dependency

See merge request nvidia/cloud-native/k8s-kata-manager!21
  • Loading branch information
cdesiniotis committed Jul 21, 2023
2 parents 4b373b6 + 6db9eca commit 4b50ba6
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
30 changes: 23 additions & 7 deletions Dockerfile.ubi8
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,36 @@

ARG BASE_DIST=ubi8
ARG CUDA_VERSION
ARG GOLANG_VERSION
ARG GOLANG_VERSION=x.x.x
ARG VERSION="N/A"

FROM golang:${GOLANG_VERSION} as builder
FROM nvcr.io/nvidia/cuda:${CUDA_VERSION}-base-${BASE_DIST} as build

RUN yum 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) 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

WORKDIR /build
# Copy the go source
COPY . .
# Build
RUN make cmds GO_BUILD_ENV='CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH}'
RUN GOOS=linux make cmd-k8s-kata-manager

FROM nvcr.io/nvidia/cuda:${CUDA_VERSION}-base-${BASE_DIST}
COPY --from=builder /build/bin/k8s-kata-manager /usr/local/bin/k8s-kata-manager
COPY --from=builder /build/bin/kata-manager /usr/local/bin/kata-manager

COPY --from=build /build/bin/k8s-kata-manager /usr/local/bin/k8s-kata-manager

RUN dnf install -y kmod

Expand Down
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ GO_CMD ?= go
GO_FMT ?= gofmt
GO_TEST_FLAGS ?= -race
LDFLAGS = -ldflags "-s -w -X github.com/NVIDIA/k8s-kata-manager/internal/version.version=$(GIT_COMMIT)"
# Use go.mod go version as a single source of truth of GO version.
GOLANG_VERSION := $(shell awk '/^go /{print $$2}' go.mod|head -n1)

##### General make targets #####
CMDS := $(patsubst ./cmd/%/,%,$(sort $(dir $(wildcard ./cmd/*/))))
Expand Down
2 changes: 2 additions & 0 deletions versions.mk
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ VERSION ?= v0.1.0
vVERSION := v$(VERSION:v%=%)

CUDA_VERSION := 12.2.0

GOLANG_VERSION := 1.20.4

0 comments on commit 4b50ba6

Please sign in to comment.