From d02fb7f26e6c60689016e5d1db363f56a895b93f Mon Sep 17 00:00:00 2001 From: Rahul Thakoor Date: Wed, 24 Apr 2024 16:59:51 +0400 Subject: [PATCH] Fix Dockerfile.template Signed-off-by: Rahul Thakoor --- Dockerfile.template | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/Dockerfile.template b/Dockerfile.template index 892d57c4..2b116ddf 100644 --- a/Dockerfile.template +++ b/Dockerfile.template @@ -1,28 +1,36 @@ ARG BALENA_ARCH=%%BALENA_ARCH%% FROM balenalib/$BALENA_ARCH-debian +ARG BALENA_ARCH=%%BALENA_ARCH%% + RUN install_packages dnsmasq wireless-tools # use latest version. If specific version is required, it should be provided as vX.Y.Z, e.g v4.11.37 -ARG VERSION=latest +ARG VERSION="latest" WORKDIR /usr/src/app RUN \ + export BASE_URL="https://github.com/balena-os/wifi-connect/releases" &&\ case $BALENA_ARCH in \ "rpi") \ BINARY_ARCH_NAME="arm-unknown-linux-gnueabihf" ;; \ "aarch64") \ BINARY_ARCH_NAME="aarch64-unknown-linux-gnu" ;; \ "amd64") \ - BINARY_ARCH_NAME="x86_64-unknown-linux-gnu.tar.gz" ;;\ + BINARY_ARCH_NAME="x86_64-unknown-linux-gnu" ;;\ "armv7hf") \ - BINARY_ARCH_NAME="armv7-unknown-linux-gnueabihf.tar.gz" ;;\ + BINARY_ARCH_NAME="armv7-unknown-linux-gnueabihf" ;;\ *) \ echo >&2 "error: unsupported architecture ($BALENA_ARCH)"; exit 1 ;; \ - esac &&\ - curl -Ls "https://github.com/balena-os/wifi-connect/releases/download/${VERSION}/wifi-connect-$BINARY_ARCH_NAME.tar.gz" \ + esac;\ + if [ ${VERSION} = "latest" ]; then \ + export URL_PARTIAL="latest/download" ; \ + else \ + export URL_PARTIAL="download/${VERSION}" ; \ + fi; \ + curl -Ls "$BASE_URL/$URL_PARTIAL/wifi-connect-$BINARY_ARCH_NAME.tar.gz" \ | tar -xvz -C /usr/src/app/ COPY scripts/start.sh .