From 772702793c3ebf9bf3ac8119934436f2caa44bef Mon Sep 17 00:00:00 2001 From: Felipe Lalanne <1822826+pipex@users.noreply.github.com> Date: Fri, 8 Mar 2024 11:42:53 -0300 Subject: [PATCH] Update fatrw to v0.2.21 Update fatrw from 0.2.9 to 0.2.21 Change-type: patch --- Dockerfile.template | 10 ++++++---- build-utils/rust-arch.sh | 25 +++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 4 deletions(-) create mode 100755 build-utils/rust-arch.sh diff --git a/Dockerfile.template b/Dockerfile.template index d9a3de78..bc238dc0 100644 --- a/Dockerfile.template +++ b/Dockerfile.template @@ -1,5 +1,5 @@ ARG ARCH=%%BALENA_ARCH%% -ARG FATRW_VERSION=0.2.9 +ARG FATRW_VERSION=0.2.21 ARG NODE="nodejs~=20" ARG NPM="npm~=10" ARG ALPINE_VERSION="3.19" @@ -13,8 +13,7 @@ ARG ARCH ARG NODE ARG NPM ARG FATRW_VERSION -ARG FATRW_ARCHIVE="fatrw-${ARCH}.tar.gz" -ARG FATRW_LOCATION="https://github.com/balena-os/fatrw/releases/download/v${FATRW_VERSION}/${FATRW_ARCHIVE}" +ARG FATRW_RELEASES="https://github.com/balena-os/fatrw/releases/download/v${FATRW_VERSION}" WORKDIR /usr/src/app @@ -30,11 +29,14 @@ RUN apk add --update --no-cache \ rust COPY package*.json ./ +COPY ./build-utils/rust-arch.sh / RUN strip "$(which node)" # Install fatrw -RUN curl -SLO "${FATRW_LOCATION}" && \ +RUN FATRW_ARCHIVE="fatrw-$(/rust-arch.sh).tar.gz" && \ + FATRW_LOCATION="${FATRW_RELEASES}/${FATRW_ARCHIVE}" && \ + curl -SLO "${FATRW_LOCATION}" && \ ls -la "${FATRW_ARCHIVE}" && \ tar -xzf "${FATRW_ARCHIVE}" -C /usr/local/bin && \ rm -f "${FATRW_ARCHIVE}" diff --git a/build-utils/rust-arch.sh b/build-utils/rust-arch.sh new file mode 100755 index 00000000..c226503d --- /dev/null +++ b/build-utils/rust-arch.sh @@ -0,0 +1,25 @@ +#!/bin/sh +# rust-arch.sh +# return the rust triple corresponding to the apk arch + +apk_arch=$(apk --print-arch) +case $apk_arch in +x86_64) + printf "x86_64-unknown-linux-musl" + ;; +aarch64) + printf "aarch64-unknown-linux-musl" + ;; +armv7) + printf "armv7-unknown-linux-musleabihf" + ;; +armhf) + printf "arm-unknown-linux-musleabihf" + ;; +x86) + printf "i686-unknown-linux-musl" + ;; +*) + printf "%s" "$apk_arch" + ;; +esac