Skip to content

Commit

Permalink
Add support to build arm images on latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiobaiao committed Feb 19, 2024
1 parent b969d8e commit 49ec55b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; }
DASH_CORE_VERSION=${{matrix.version}}
LATEST_DASH_CORE_MAJOR_VERSION=$(ls | grep 0 | sort -n | tail -n 1)
PLATFORMS="linux/amd64"
PUSH=false
REPO=uphold/dash-core
TAGS=()
Expand Down Expand Up @@ -61,7 +62,13 @@ jobs:
PUSH=true
fi
fi
if [[ ${DASH_CORE_VERSION} != *"alpine"* ]] && [ $(version ${DASH_CORE_VERSION}) -ge $(version "20") ]; 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 "build=true" >> $GITHUB_ENV
Expand All @@ -77,16 +84,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
14 changes: 9 additions & 5 deletions 20/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,15 @@ ENV DASH_VERSION=20.0.4
ENV DASH_FOLDER_VERSION=20.0.4
ENV DASH_DATA=/home/dash/.dashcore \
PATH=/opt/dashcore-${DASH_FOLDER_VERSION}/bin:$PATH
RUN curl -SLO https://github.com/dashpay/dash/releases/download/v${DASH_VERSION}/SHA256SUMS.asc \
&& curl -SLO https://github.com/dashpay/dash/releases/download/v${DASH_VERSION}/dashcore-${DASH_VERSION}-x86_64-linux-gnu.tar.gz \
&& curl -SLO https://github.com/dashpay/dash/releases/download/v${DASH_VERSION}/dashcore-${DASH_VERSION}-x86_64-linux-gnu.tar.gz.asc \
&& gpg --verify dashcore-${DASH_VERSION}-x86_64-linux-gnu.tar.gz.asc \
&& tar -xzf dashcore-${DASH_VERSION}-x86_64-linux-gnu.tar.gz -C /opt \
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/dashpay/dash/releases/download/v${DASH_VERSION}/SHA256SUMS.asc \
&& curl -SLO https://github.com/dashpay/dash/releases/download/v${DASH_VERSION}/dashcore-${DASH_VERSION}-${TARGETPLATFORM}.tar.gz \
&& curl -SLO https://github.com/dashpay/dash/releases/download/v${DASH_VERSION}/dashcore-${DASH_VERSION}-${TARGETPLATFORM}.tar.gz.asc \
&& gpg --verify dashcore-${DASH_VERSION}-${TARGETPLATFORM}.tar.gz.asc \
&& tar -xzf dashcore-${DASH_VERSION}-${TARGETPLATFORM}.tar.gz -C /opt \
&& rm *.tar.gz

VOLUME ["/home/dash/.dashcore"]
Expand Down

0 comments on commit 49ec55b

Please sign in to comment.