envplate
envplate copied to clipboard
Cannot match release with uname -m with Arm based Docker image
Expected Behavior
Matching Envplate release with uname -m does not work in Dockerfile for M1 (arm), please see:
curl -LJ --silent https://github.com/kreuzwerker/envplate/releases/download/v1.0.3/envplate_1.0.3_Linux_$(uname -m).tar.gz -o envplate_aarch64.tar.gz
I use this to go around:
#
# Envplate
#
FROM alpine AS envplate-builder
ARG REPO=https://github.com/kreuzwerker/envplate/releases/download
ARG VERSION=1.0.3
WORKDIR /tmp
RUN apk add curl
RUN <<EOF
curl -LJ --silent ${REPO}/v${VERSION}/envplate_${VERSION}_Linux_arm64.tar.gz -o envplate_aarch64.tar.gz
curl -LJ --silent ${REPO}/v${VERSION}/envplate_${VERSION}_Linux_x86_64.tar.gz -o envplate_x86_64.tar.gz
tar -xf envplate_$(uname -m).tar.gz
chmod +x envplate
EOF
Actual Behavior
uname -mwill giveaarch64instead and thus cannot match toarm64in release filename.
Steps to Reproduce (including precondition)
Try building Docker image with this Dockerfile in M1/M2 Mac (Silicon/ARM processor):
FROM alpine
RUN apk add curl
RUN curl -LJ --silent https://github.com/kreuzwerker/envplate/releases/download/v1.0.3/envplate_1.0.3_Linux_$(uname -m).tar.gz
Your Environment
- OS: Alpine 3.18
- envplate version: 1.0.2, 1.0.3
My current workaround:
FROM alpine AS envplate-builder
ARG VERSION=1.0.3
ARG TARGETPLATFORM
RUN case ${TARGETPLATFORM} in "linux/amd64") ARCH=x86_64 ;; "linux/arm64") ARCH=arm64 ;; esac && echo "$ARCH" && \
wget -q https://github.com/kreuzwerker/envplate/releases/download/v${VERSION}/envplate_${VERSION}_Linux_${ARCH}.tar.gz -O /envplate && \
chmod +x /envplate