2025-08-13 21:56:00 -05:00
|
|
|
# syntax=docker/dockerfile:1.6
|
|
|
|
|
|
2025-08-14 00:34:13 -05:00
|
|
|
ARG DEBIAN_IMAGE=debian:bookworm-slim
|
|
|
|
|
ARG P2POOL_VERSION=4.9
|
|
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
|
# Stage: fetch — download & extract the right release asset, normalize to /opt/bin/p2pool
|
|
|
|
|
################################################################################
|
|
|
|
|
FROM ${DEBIAN_IMAGE} AS fetch
|
2025-08-13 21:56:00 -05:00
|
|
|
ARG TARGETARCH
|
2025-08-14 00:34:13 -05:00
|
|
|
ARG P2POOL_VERSION
|
2025-08-13 21:56:00 -05:00
|
|
|
|
|
|
|
|
RUN set -eux; \
|
|
|
|
|
apt-get update; \
|
2025-08-14 00:34:13 -05:00
|
|
|
apt-get install -y --no-install-recommends ca-certificates curl jq xz-utils tar unzip; \
|
2025-08-13 21:56:00 -05:00
|
|
|
update-ca-certificates; \
|
2025-08-14 00:34:13 -05:00
|
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
|
|
RUN set -eux; \
|
2025-08-13 21:56:00 -05:00
|
|
|
case "${TARGETARCH:-arm64}" in \
|
2025-08-14 00:34:13 -05:00
|
|
|
amd64) ARCH_RE='(x86_64|amd64)';; \
|
|
|
|
|
arm64) ARCH_RE='(arm64|aarch64|armv8)';; \
|
|
|
|
|
arm) ARCH_RE='(arm|armv7|armhf)';; \
|
|
|
|
|
*) echo "Unsupported TARGETARCH=${TARGETARCH}"; exit 1;; \
|
2025-08-13 21:56:00 -05:00
|
|
|
esac; \
|
2025-08-14 00:34:13 -05:00
|
|
|
API_URL="https://api.github.com/repos/SChernykh/p2pool/releases/tags/v${P2POOL_VERSION}"; \
|
|
|
|
|
ASSET_URL="$(curl -fsSL -H 'Accept: application/vnd.github+json' "$API_URL" \
|
|
|
|
|
| jq -r --arg re "$ARCH_RE" \
|
|
|
|
|
'.assets[] | select((.name|test("linux")) and (.name|test($re))) | .browser_download_url' \
|
|
|
|
|
| head -n1)"; \
|
|
|
|
|
test -n "$ASSET_URL"; \
|
|
|
|
|
echo "Fetching $ASSET_URL"; \
|
|
|
|
|
curl -fL "$ASSET_URL" -o /tmp/p2pool.pkg; \
|
|
|
|
|
mkdir -p /tmp/ex && cd /tmp/ex; \
|
|
|
|
|
case "$ASSET_URL" in \
|
|
|
|
|
*.tar.xz) tar -xJf /tmp/p2pool.pkg ;; \
|
|
|
|
|
*.tar.gz) tar -xzf /tmp/p2pool.pkg ;; \
|
|
|
|
|
*.zip) unzip -q /tmp/p2pool.pkg ;; \
|
|
|
|
|
*) echo "Unknown archive format: $ASSET_URL"; exit 1 ;; \
|
|
|
|
|
esac; \
|
|
|
|
|
BIN="$(find . -maxdepth 2 -type f -name 'p2pool*' -executable | sort | head -n1)"; \
|
|
|
|
|
test -n "$BIN"; \
|
|
|
|
|
install -Dm0755 "$BIN" /opt/bin/p2pool; \
|
|
|
|
|
/opt/bin/p2pool --help >/dev/null 2>&1 || true
|
|
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
|
# Stage: runtime
|
|
|
|
|
################################################################################
|
|
|
|
|
FROM ${DEBIAN_IMAGE}
|
|
|
|
|
RUN set -eux; \
|
|
|
|
|
apt-get update; \
|
|
|
|
|
apt-get install -y --no-install-recommends ca-certificates; \
|
|
|
|
|
update-ca-certificates; \
|
|
|
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
|
|
COPY --from=fetch /opt/bin/p2pool /usr/local/bin/p2pool
|
2025-08-13 21:56:00 -05:00
|
|
|
|
|
|
|
|
EXPOSE 3333
|
2025-08-14 00:34:13 -05:00
|
|
|
ENTRYPOINT ["p2pool"]
|