From e84a000b92f9120fa03c9f8f7cb5a8ba6b66e429 Mon Sep 17 00:00:00 2001 From: Kingdon Barrett Date: Wed, 29 Mar 2023 15:21:42 -0400 Subject: [PATCH] multiarch (alpine) Add one more BUILDPLATFORM as needed for down build + x1 more (try again) and it's linux/${TARGETARCH} I thought that ${TARGETPLATFORM} was a thing according to this blog: https://www.docker.com/blog/faster-multi-platform-builds-dockerfile-cross-compilation-guide/ but it doesn't seem to be there reliably, whereas ${TARGETARCH} is set. Signed-off-by: Kingdon Barrett --- reweave/build/Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/reweave/build/Dockerfile b/reweave/build/Dockerfile index 58ca3f15..4f17bd26 100644 --- a/reweave/build/Dockerfile +++ b/reweave/build/Dockerfile @@ -7,7 +7,7 @@ ARG ALPINE_BASEIMAGE=alpine:3.17.2 # It will be built only once for a given build platform. Subsequent # stages will start from this and cross-compile for each target # architecture. -FROM --platform=$BUILDPLATFORM golang:1.20.2-bullseye AS builderbase +FROM --platform=${BUILDPLATFORM} golang:1.20.2-bullseye AS builderbase # Support Raspberry Pi 2 and newer ENV GOARM 7 @@ -77,7 +77,7 @@ EOMAKE # Stage 3: Alpine Base # This stage exists in case there are any additional tweaks # required in the alpine base image. -FROM ${ALPINE_BASEIMAGE} as alpinebase +FROM --platform=linux/${TARGETARCH} ${ALPINE_BASEIMAGE} as alpinebase # Any additional tweaks will appear here # End Stage 3 ######## @@ -250,10 +250,10 @@ LABEL org.opencontainers.image.revision="${revision}" \ # See the License for the specific language governing permissions and # limitations under the License. -FROM bash AS networktesterimage +FROM --platform=linux/${TARGETARCH} bash AS networktesterimage RUN apk add --no-cache curl bind-tools COPY --from=builder /root/weave/test/images/network-tester/webserver webserver EXPOSE 8080 ENTRYPOINT ["/webserver"] # End Stage 9 -######## \ No newline at end of file +########