Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
ARG FROM=alpine
FROM $FROM AS cni
ARG GOARCH=amd64
# TARGETARCH is automatically set by Docker buildx for multi-platform builds
ARG TARGETARCH
ARG GOARCH=${TARGETARCH:-amd64}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This is a good change for supporting multi-platform builds in the cni stage. However, the second stage of this Dockerfile also depends on the architecture but has not been updated. The ARG GOARCH on line 12 is declared without a value, so when using buildx it will be empty. This will cause the COPY commands on lines 20-21 to fail.

To fully enable multi-platform builds as intended, you should apply the same pattern to the second build stage by adding ARG TARGETARCH and setting ARG GOARCH=${TARGETARCH:-amd64}.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, fixed in 71eea82 — applied the same TARGETARCH pattern to the runtime stage.

ARG CNI_PLUGINS_VERSION=v1.1.1
RUN apk add --no-cache curl && \
curl -Lo cni.tar.gz https://github.com/containernetworking/plugins/releases/download/$CNI_PLUGINS_VERSION/cni-plugins-linux-$GOARCH-$CNI_PLUGINS_VERSION.tgz && \
tar -xf cni.tar.gz

FROM $FROM
ARG GOARCH
ARG TARGETARCH
ARG GOARCH=${TARGETARCH:-amd64}
ARG ALPINE_VERSION=v3.20
LABEL maintainer="squat <lserven@gmail.com>"
RUN echo -e "https://alpine.global.ssl.fastly.net/alpine/$ALPINE_VERSION/main\nhttps://alpine.global.ssl.fastly.net/alpine/$ALPINE_VERSION/community" > /etc/apk/repositories && \
Expand Down