From 15a576536eaf0499139a52df5931e23beb139a19 Mon Sep 17 00:00:00 2001 From: Gary Benson Date: Sat, 11 Nov 2023 11:22:56 +0000 Subject: [PATCH] Also build arm64 container images --- .../workflows/docker-build-push-monerod.yml | 2 +- .../workflows/docker-build-push-p2pool.yml | 2 +- monerod/Dockerfile | 34 +++++++++------- p2pool/Dockerfile | 39 ++++++++++++------- xmrig/Dockerfile | 30 +++++++------- 5 files changed, 62 insertions(+), 45 deletions(-) diff --git a/.github/workflows/docker-build-push-monerod.yml b/.github/workflows/docker-build-push-monerod.yml index 5a99a3a..31626b6 100644 --- a/.github/workflows/docker-build-push-monerod.yml +++ b/.github/workflows/docker-build-push-monerod.yml @@ -38,7 +38,7 @@ jobs: uses: docker/build-push-action@v5 with: context: monerod - platforms: linux/amd64 + platforms: linux/amd64,linux/arm64 push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/docker-build-push-p2pool.yml b/.github/workflows/docker-build-push-p2pool.yml index cbf212b..00415ba 100644 --- a/.github/workflows/docker-build-push-p2pool.yml +++ b/.github/workflows/docker-build-push-p2pool.yml @@ -37,7 +37,7 @@ jobs: uses: docker/build-push-action@v5 with: context: p2pool - platforms: linux/amd64 + platforms: linux/amd64,linux/arm64 push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/monerod/Dockerfile b/monerod/Dockerfile index dfd5558..221c356 100644 --- a/monerod/Dockerfile +++ b/monerod/Dockerfile @@ -1,11 +1,4 @@ FROM debian:12-slim as base - -ENV NAME=monero -ENV VERSION=v0.18.3.1 -ENV TARBALL=$NAME-linux-x64-$VERSION.tar.bz2 -ENV DOWNLOAD=https://downloads.getmonero.org/cli -ENV HASH=23af572fdfe3459b9ab97e2e9aa7e3c11021c955d6064b801a27d7e8c21ae09d - RUN set -eux \ \ && apt-get -y update \ @@ -15,18 +8,33 @@ RUN set -eux \ && rm -rf /var/lib/apt FROM base as builder -RUN set -eux \ + +ARG NAME=monero +ARG VERSION=v0.18.3.1 +ARG DOWNLOAD=https://downloads.getmonero.org/cli + +RUN set -eux; \ \ + case $(uname -m) in \ + x86_64) \ + ARCH=linux-x64 \ + HASH=23af572fdfe3459b9ab97e2e9aa7e3c11021c955d6064b801a27d7e8c21ae09d \ + ;; \ + aarch64) \ + ARCH=linux-armv7 \ + HASH=2ea2c8898cbab88f49423f4f6c15f2a94046cb4bbe827493dd061edc0fd5f1ca \ + ;; \ + *) exit 1 ;; \ + esac; \ + TARBALL=$NAME-$ARCH-$VERSION.tar.bz2; \ + echo "$HASH $TARBALL" > SHA256SUMS \ && curl -Lo $TARBALL $DOWNLOAD/$TARBALL \ - && sha256sum $TARBALL \ - && echo "$HASH $TARBALL" > SHA256SUMS \ && sha256sum -c SHA256SUMS \ && tar xf $TARBALL \ - && rm $TARBALL \ - && mv /$NAME-* /$NAME + && mv /$NAME-*-$VERSION /build FROM base -COPY --from=builder /$NAME/$NAME* /usr/bin/ +COPY --from=builder /build/monero* /usr/bin/ ARG m_USER=monerod ARG m_UID=801 diff --git a/p2pool/Dockerfile b/p2pool/Dockerfile index b62a397..3e82465 100644 --- a/p2pool/Dockerfile +++ b/p2pool/Dockerfile @@ -1,13 +1,4 @@ FROM debian:12-slim as base - -ENV NAME=p2pool -ENV VERSION=v3.8 -ENV PACKAGE=$NAME-$VERSION -ENV ARCH=linux-x64 -ENV TARBALL=$PACKAGE-$ARCH.tar.gz -ENV DOWNLOAD=https://github.com/SChernykh/$NAME/releases/download -ENV HASH=019d62a4bb6d3cf22950e07ad9b49158e6fdadc006a7589edf077b338f0baf98 - RUN set -eux \ \ && apt-get -y update \ @@ -17,18 +8,36 @@ RUN set -eux \ && rm -rf /var/lib/apt FROM base as builder -RUN set -eux \ + +ARG NAME=p2pool +ARG VERSION=v3.8 +ARG PACKAGE=$NAME-$VERSION +ARG DOWNLOAD=https://github.com/SChernykh/$NAME/releases/download + +RUN set -eux; \ \ + case $(uname -m) in \ + x86_64) \ + ARCH=linux-x64 \ + HASH=019d62a4bb6d3cf22950e07ad9b49158e6fdadc006a7589edf077b338f0baf98 \ + ;; \ + aarch64) \ + ARCH=linux-aarch64 \ + HASH=3b233ae9e08fc2d5cd6698a1706c5869c9efa36b6db5e2752b766e29bc599f07 \ + ;; \ + *) exit 1 ;; \ + esac; \ + TARBALL=$PACKAGE-$ARCH.tar.gz; \ + echo "$HASH $TARBALL" > SHA256SUMS \ && curl -Lo $TARBALL $DOWNLOAD/$VERSION/$TARBALL \ - && sha256sum $TARBALL \ - && echo "$HASH $TARBALL" > SHA256SUMS \ && sha256sum -c SHA256SUMS \ - && tar xf $TARBALL + && tar xf $TARBALL \ + && mv /$PACKAGE-$ARCH /build FROM base -COPY --from=builder /$PACKAGE-$ARCH/p2pool /usr/bin +COPY --from=builder /build/p2pool /usr/bin -ARG m_USER=$NAME +ARG m_USER=p2pool ARG m_UID=802 ARG m_GID=$m_UID diff --git a/xmrig/Dockerfile b/xmrig/Dockerfile index 30fc682..d894189 100644 --- a/xmrig/Dockerfile +++ b/xmrig/Dockerfile @@ -1,13 +1,4 @@ -FROM debian:12 as base - -ENV NAME=xmrig -ENV VERSION=6.20.0 -ENV PACKAGE=$NAME-$VERSION -ENV ARCH=linux-static-x64 -ENV TARBALL=$PACKAGE-$ARCH.tar.gz -ENV DOWNLOAD=https://github.com/xmrig/$NAME/releases/download -ENV HASH=ff6e67d725ee64b4607dc6490a706dc9234c708cff814477de52d3beb781c6a1 - +FROM debian:12-slim as base RUN set -eux \ \ && apt-get -y update \ @@ -17,20 +8,29 @@ RUN set -eux \ && rm -rf /var/lib/apt FROM base as builder + +ARG NAME=xmrig +ARG VERSION=6.20.0 +ARG PACKAGE=$NAME-$VERSION +ARG ARCH=linux-static-x64 +ARG TARBALL=$PACKAGE-$ARCH.tar.gz +ARG DOWNLOAD=https://github.com/xmrig/$NAME/releases/download +ARG HASH=ff6e67d725ee64b4607dc6490a706dc9234c708cff814477de52d3beb781c6a1 + RUN set -eux \ \ - && curl -Lo $TARBALL $DOWNLOAD/v$VERSION/$TARBALL \ - && sha256sum $TARBALL \ && echo "$HASH $TARBALL" > SHA256SUMS \ + && curl -Lo $TARBALL $DOWNLOAD/v$VERSION/$TARBALL \ && sha256sum -c SHA256SUMS \ && tar xf $TARBALL \ - && cd $NAME-$VERSION \ + && mv /$NAME-$VERSION /build \ + && cd /build \ && sha256sum -c SHA256SUMS FROM base RUN mkdir -m0700 /etc/xmrig -COPY --from=builder /$NAME-$VERSION/xmrig /usr/bin -COPY --from=builder --chmod=600 /$NAME-$VERSION/config.json /etc/xmrig +COPY --from=builder /build/xmrig /usr/bin +COPY --from=builder --chmod=600 /build/config.json /etc/xmrig VOLUME /srv WORKDIR /srv/xmrig