Skip to content

Commit 54f5138

Browse files
committed
Update dockerfile to start supporting multi-arch builds
1 parent 9cd648c commit 54f5138

File tree

1 file changed

+4
-23
lines changed

1 file changed

+4
-23
lines changed

Dockerfile

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,7 @@
11
# Build the manager binary
2+
FROM registry.access.redhat.com/ubi9/go-toolset:1.23 AS builder
23

3-
# BEGIN -- workaround lack of go-toolset for golang 1.23
4-
ARG GOLANG_IMAGE=docker.io/library/golang:1.23
5-
FROM ${GOLANG_IMAGE} AS golang
6-
7-
FROM registry.access.redhat.com/ubi8/ubi@sha256:fd3bf22d0593e2ed26a1c74ce161c52295711a67de677b5938c87704237e49b0 AS builder
8-
ARG GOLANG_VERSION=1.23.0
9-
10-
# Install system dependencies
11-
RUN dnf upgrade -y && dnf install -y \
12-
gcc \
13-
make \
14-
openssl-devel \
15-
git \
16-
&& dnf clean all && rm -rf /var/cache/yum
17-
18-
# Install Go
19-
ENV PATH=/usr/local/go/bin:$PATH
20-
21-
COPY --from=golang /usr/local/go /usr/local/go
22-
# End of Go versioning workaround
4+
ARG TARGETOS TARGETARCH
235

246
WORKDIR /workspace
257
# Copy the Go Modules manifests
@@ -32,11 +14,10 @@ RUN go mod download
3214
COPY main.go main.go
3315
COPY pkg/ pkg/
3416

35-
# Build
3617
USER root
37-
RUN CGO_ENABLED=1 GOOS=linux GOARCH=${GOARCH} make go-build-for-image
18+
RUN CGO_ENABLED=1 GOOS=linux GOARCH=${TARGETARCH:-amd64} make go-build-for-image
3819

39-
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.8
20+
FROM registry.access.redhat.com/ubi9/ubi-minimal:latest
4021
WORKDIR /
4122
COPY --from=builder /workspace/manager .
4223

0 commit comments

Comments
 (0)