Skip to content

Commit

Permalink
Add support to build arm images
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiobaiao committed Mar 13, 2024
1 parent 3433ecd commit c195671
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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=()
Expand Down Expand Up @@ -56,7 +57,13 @@ 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
Expand All @@ -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 }}" \
Expand Down
9 changes: 7 additions & 2 deletions 0.17/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit c195671

Please sign in to comment.