Skip to content

Commit 93b28bd

Browse files
committed
adapt Dockerfile changes for go 1.21 from project-codeflare#491
1 parent 98d4829 commit 93b28bd

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

Diff for: Dockerfile

+23-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
11
# Build the manager binary
2-
FROM registry.access.redhat.com/ubi8/go-toolset:1.20.10 as builder
2+
3+
# BEGIN -- workaround lack of go-toolset for golang 1.21
4+
5+
ARG GOLANG_IMAGE=golang:1.21
6+
7+
ARG GOARCH=amd64
8+
9+
FROM ${GOLANG_IMAGE} AS golang
10+
FROM registry.access.redhat.com/ubi8/ubi:8.8 AS builder
11+
12+
# Install system dependencies
13+
RUN dnf upgrade -y && dnf install -y \
14+
gcc \
15+
make \
16+
openssl-devel \
17+
&& dnf clean all && rm -rf /var/cache/yum
18+
19+
# Install Go
20+
ENV PATH=/usr/local/go/bin:$PATH
21+
COPY --from=golang /usr/local/go /usr/local/go
22+
23+
# END -- workaround lack of go-toolset for golang 1.21
324

425
WORKDIR /workspace
526
# Copy the Go Modules manifests
@@ -13,7 +34,7 @@ COPY pkg/ pkg/
1334

1435
# Build
1536
USER root
16-
RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -tags strictfipsruntime -a -o manager main.go
37+
RUN CGO_ENABLED=1 GOOS=linux GOARCH=${GOARCH} go build -tags strictfipsruntime -a -o manager main.go
1738

1839
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.8
1940
WORKDIR /

0 commit comments

Comments
 (0)