Skip to content

Commit 25b1186

Browse files
authored
use go version from builder image, instead of downloading in Dockerfile (#6996)
Signed-off-by: Adam D. Cornett <[email protected]>
1 parent 83d7c06 commit 25b1186

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

images/operator-sdk/Dockerfile

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,12 @@ RUN GOOS=linux GOARCH=$TARGETARCH make build/operator-sdk
1919
# Final image.
2020
FROM registry.access.redhat.com/ubi9/ubi-minimal:9.6
2121

22-
# TODO: Figure out how to take the go binary from the builder image so this doesn't have to be maintained.
23-
ENV GO_VERSION=1.23.4
24-
2522
ARG TARGETARCH
2623
RUN microdnf install -y make gcc which tar gzip
27-
RUN curl -sSLo /tmp/go.tar.gz https://golang.org/dl/go${GO_VERSION}.linux-${TARGETARCH}.tar.gz \
28-
&& rm -rf /usr/local/go \
29-
&& tar -C /usr/local -xzf /tmp/go.tar.gz \
30-
&& ln -sf /usr/local/go/bin/* /usr/local/bin/ \
31-
&& rm -f /tmp/go.tar.gz \
32-
&& go version
24+
25+
# Copy Go runtime from builder image
26+
COPY --from=builder /usr/local/go /usr/local/go
27+
RUN ln -sf /usr/local/go/bin/* /usr/local/bin/ && go version
3328

3429
COPY --from=builder /workspace/build/operator-sdk /usr/local/bin/operator-sdk
3530

0 commit comments

Comments
 (0)