It turns out that this can be solved by using the TARGETARCH
variable in my Dockerfile.
So instead of:
RUN set -eux; \
case "$(uname -m)" in \
aarch64) ARCH="arm64";; \
armv7l) ARCH="arm";;\
riscv64) ARCH="riscv64";;\
x86_64) ARCH="x64";;\
esac; \
I can use:
ARG TARGETARCH
RUN set -eux; \
case "${TARGETARCH}" in \
amd64) ARCH="x64";;\
*) ARCH=${TARGETARCH};; \
esac; \
and the ARCH variable then gets set correctly to arm
.
With thanks to Bret Fisher and his multi-platform-docker-build repo for showing the way (sadly one of those things where I'd seen this before, but not fully learned to do things the 'right' way going forward).