Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to build arm images #23

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
15 changes: 10 additions & 5 deletions 20/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 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
Loading