Skip to content

Commit

Permalink
adapt Dockerfile changes for go 1.21 from #491
Browse files Browse the repository at this point in the history
  • Loading branch information
dgrove-oss authored and openshift-merge-bot[bot] committed May 16, 2024
1 parent c4bb901 commit 2cb14bb
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
# Build the manager binary
FROM registry.access.redhat.com/ubi8/go-toolset:1.20.10 as builder

# BEGIN -- workaround lack of go-toolset for golang 1.21

ARG GOLANG_IMAGE=golang:1.21

ARG GOARCH=amd64

FROM ${GOLANG_IMAGE} AS golang
FROM registry.access.redhat.com/ubi8/ubi:8.8 AS builder

# Install system dependencies
RUN dnf upgrade -y && dnf install -y \
gcc \
make \
openssl-devel \
&& dnf clean all && rm -rf /var/cache/yum

# Install Go
ENV PATH=/usr/local/go/bin:$PATH
COPY --from=golang /usr/local/go /usr/local/go

# END -- workaround lack of go-toolset for golang 1.21

WORKDIR /workspace
# Copy the Go Modules manifests
Expand All @@ -14,7 +35,7 @@ COPY pkg/ pkg/

# Build
USER root
RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 make go-build-for-image
RUN CGO_ENABLED=1 GOOS=linux GOARCH=${GOARCH} make go-build-for-image

FROM registry.access.redhat.com/ubi8/ubi-minimal:8.8
WORKDIR /
Expand Down

0 comments on commit 2cb14bb

Please sign in to comment.