From 22d8a8edb47e634923ad8198e46e14b5ad1215e0 Mon Sep 17 00:00:00 2001 From: fabiobaiao Date: Mon, 19 Feb 2024 16:48:27 +0000 Subject: [PATCH] Add support to build arm images --- .github/workflows/build.yaml | 4 ++++ 0.21/Dockerfile | 9 +++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index a92ce87..f1f3ba9 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -70,6 +70,10 @@ jobs: fi fi + if [[ ${LITECOIN_VERSION} != *"alpine"* ]] && [ $(version ${LITECOIN_VERSION}) -ge $(version "0.21") ]; then + PLATFORMS="linux/amd64,linux/arm/v7,linux/arm64" + fi + echo ::set-output name=build_date::$(date -u +'%Y-%m-%dT%H:%M:%SZ') echo ::set-output name=docker_platforms::${PLATFORMS} echo ::set-output name=push::${PUSH} diff --git a/0.21/Dockerfile b/0.21/Dockerfile index e165654..cf1e4e8 100644 --- a/0.21/Dockerfile +++ b/0.21/Dockerfile @@ -30,13 +30,18 @@ RUN curl -o /usr/local/bin/gosu -fSL https://github.com/tianon/gosu/releases/dow && rm /usr/local/bin/gosu.asc \ && chmod +x /usr/local/bin/gosu +ARG TARGETPLATFORM ENV LITECOIN_VERSION=0.21.2.2 ENV LITECOIN_DATA=/home/litecoin/.litecoin -RUN curl -SLO https://download.litecoin.org/litecoin-${LITECOIN_VERSION}/linux/litecoin-${LITECOIN_VERSION}-x86_64-linux-gnu.tar.gz \ +RUN set -ex \ + && if [ "${TARGETPLATFORM}" = "linux/amd64" ]; then export TARGETPLATFORM=x86_64-linux-gnu; fi \ + && if [ "${TARGETPLATFORM}" = "linux/arm64" ]; then export TARGETPLATFORM=aarch64-linux-gnu; fi \ + && if [ "${TARGETPLATFORM}" = "linux/arm/v7" ]; then export TARGETPLATFORM=arm-linux-gnueabihf; fi \ + && curl -SLO https://download.litecoin.org/litecoin-${LITECOIN_VERSION}/linux/litecoin-${LITECOIN_VERSION}-${TARGETPLATFORM}.tar.gz \ && curl -SLO https://download.litecoin.org/litecoin-${LITECOIN_VERSION}/SHA256SUMS.asc \ && gpg --verify SHA256SUMS.asc \ - && grep $(sha256sum litecoin-${LITECOIN_VERSION}-x86_64-linux-gnu.tar.gz | awk '{ print $1 }') SHA256SUMS.asc \ + && grep $(sha256sum litecoin-${LITECOIN_VERSION}-${TARGETPLATFORM}.tar.gz | awk '{ print $1 }') SHA256SUMS.asc \ && tar --strip=2 -xzf *.tar.gz -C /usr/local/bin \ && rm *.tar.gz