From 5fada707e6ba497c1d08db9f73061ed15a98383b Mon Sep 17 00:00:00 2001 From: "Quentin McGaw (desktop)" Date: Thu, 8 Jul 2021 12:29:29 -0400 Subject: [PATCH] Use x86_64 musl tooling when on amd64 --- Dockerfile | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2d6d7f4..c41073e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,6 +29,15 @@ RUN touch /tmp/rustflags && \ echo "-C target-feature=-crt-static" | tee /tmp/rustflags; \ fi +ARG BUILDPLATFORM +RUN echo "Setting variables for build platform ${BUILDPLATFORM}" && \ + case "${BUILDPLATFORM}" in \ + linux/amd64) MUSLURL="https://more.musl.cc/x86_64-linux-musl/"; break;; \ + linux/386) MUSLURL="https://musl.cc/"; break;; \ + *) echo "build platform ${BUILDPLATFORM} is unsupported"; exit 1;; \ + esac && \ + echo "${MUSLURL}" | tee /tmp/muslurl + ARG TARGETPLATFORM RUN echo "Setting variables for ${TARGETPLATFORM:=linux/amd64}" && \ case "${TARGETPLATFORM}" in \ @@ -69,8 +78,9 @@ RUN echo "Setting variables for ${TARGETPLATFORM:=linux/amd64}" && \ echo "${MUSL}" | tee /tmp/musl && \ echo "${RUSTTARGET}" | tee /tmp/rusttarget -RUN MUSL="$(cat /tmp/musl)" && \ - wget -qO- "https://musl.cc/$MUSL-cross.tgz" | tar -xzC /tmp && \ +RUN MUSL_URL="$(cat /tmp/muslurl)" && \ + MUSL="$(cat /tmp/musl)" && \ + wget -qO- "${MUSL_URL}/${MUSL}-cross.tgz" | tar -xzC /tmp && \ rm "/tmp/$MUSL-cross/usr" && \ cp -fr /tmp/"$MUSL"-cross/* / && \ rm -rf "/tmp/$MUSL-cross"