diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 07c4171..761ed79 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -26,6 +26,7 @@ jobs: function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; } BITCOIN_GOLD_VERSION=${{matrix.version}} LATEST_BITCOIN_GOLD_MAJOR_VERSION=$(ls | grep 0 | sort -n | tail -n 1) + PLATFORMS="linux/amd64" PUSH=false REPO=uphold/bitcoin-gold TAGS=() @@ -56,10 +57,16 @@ jobs: PUSH=true fi fi + + if [[ ${BITCOIN_GOLD_VERSION} != *"alpine"* ]] && [ $(version ${BITCOIN_GOLD_VERSION}) -ge $(version "0.17") ]; 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} echo ::set-output name=tags::${TAGS[@]} - echo ::set-env name=build::true + echo "build=true" >> $GITHUB_ENV - if: env.build == 'true' name: Login into Docker Hub env: @@ -72,16 +79,17 @@ jobs: run: | TAGS=(${{ steps.prepare.outputs.tags }}) echo "Build date: ${{ steps.prepare.outputs.build_date }}" + echo "Docker platform: ${{ steps.prepare.outputs.docker_platforms }}" echo "Push: ${{ steps.prepare.outputs.push }}" echo "Tags: ${{ steps.prepare.outputs.tags }}" - echo docker buildx build \ + echo docker buildx build --platform ${{ steps.prepare.outputs.docker_platforms }} \ --output "type=image,push=${{steps.prepare.outputs.push}}" \ --progress=plain \ --build-arg "BUILD_DATE=${{ steps.prepare.outputs.build_date }}" \ --build-arg "VCS_REF=${GITHUB_SHA::8}" \ $(printf "%s" "${TAGS[@]/#/ --tag }" ) \ ${{ matrix.version }}/ - docker buildx build \ + docker buildx build --platform ${{ steps.prepare.outputs.docker_platforms }} \ --output "type=image,push=${{steps.prepare.outputs.push}}" \ --progress=plain \ --build-arg "BUILD_DATE=${{ steps.prepare.outputs.build_date }}" \ diff --git a/0.17/Dockerfile b/0.17/Dockerfile index a525efd..a30b393 100644 --- a/0.17/Dockerfile +++ b/0.17/Dockerfile @@ -28,15 +28,20 @@ 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 BITCOIN_GOLD_VERSION=0.17.3 ENV BITCOIN_GOLD_FOLDER_VERSION=0.17.3 ENV BITCOIN_GOLD_PREFIX=/opt/bitcoin-gold-${BITCOIN_GOLD_FOLDER_VERSION} ENV BITCOIN_GOLD_DATA=/home/bitcoingold/.bitcoingold ENV PATH=${BITCOIN_GOLD_PREFIX}/bin:$PATH -RUN curl -SLO https://github.com/BTCGPU/BTCGPU/releases/download/v${BITCOIN_GOLD_VERSION}/bitcoin-gold-${BITCOIN_GOLD_FOLDER_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://github.com/BTCGPU/BTCGPU/releases/download/v${BITCOIN_GOLD_VERSION}/bitcoin-gold-${BITCOIN_GOLD_FOLDER_VERSION}-${TARGETPLATFORM}.tar.gz \ && curl -SLO https://github.com/BTCGPU/BTCGPU/releases/download/v${BITCOIN_GOLD_VERSION}/SHA256SUMS.asc \ && gpg --verify SHA256SUMS.asc \ - && grep " bitcoin-gold-${BITCOIN_GOLD_FOLDER_VERSION}-x86_64-linux-gnu.tar.gz\$" SHA256SUMS.asc | sha256sum -c - \ + && grep " bitcoin-gold-${BITCOIN_GOLD_FOLDER_VERSION}-${TARGETPLATFORM}.tar.gz\$" SHA256SUMS.asc | sha256sum -c - \ && tar -xzf *.tar.gz -C /opt \ && rm *.tar.gz