titan-iac/dockerfiles/Dockerfile.monero-p2pool

38 lines
1.4 KiB
Docker
Raw Normal View History

# syntax=docker/dockerfile:1.6
2025-08-14 00:34:13 -05:00
ARG DEBIAN_IMAGE=debian:bookworm-slim
2025-08-14 00:47:10 -05:00
ARG P2POOL_VERSION=v4.9
2025-08-14 00:34:13 -05:00
FROM ${DEBIAN_IMAGE} AS fetch
ARG TARGETARCH
2025-08-14 00:34:13 -05:00
ARG P2POOL_VERSION
RUN set -eux; \
apt-get update; \
2025-08-14 20:37:30 -05:00
apt-get install -y --no-install-recommends ca-certificates curl jq xz-utils tar; \
update-ca-certificates; rm -rf /var/lib/apt/lists/*
2025-08-14 00:34:13 -05:00
RUN set -eux; \
case "${TARGETARCH:-arm64}" in \
2025-08-14 20:37:30 -05:00
amd64) ARCH_RE='(x86_64|amd64)';; \
arm64) ARCH_RE='(arm64|aarch64|armv8)';; \
arm) ARCH_RE='(arm|armv7|armhf)';; \
2025-08-14 00:34:13 -05:00
*) echo "Unsupported TARGETARCH=${TARGETARCH}"; exit 1;; \
esac; \
2025-08-14 00:47:10 -05:00
API="https://api.github.com/repos/SChernykh/p2pool/releases/tags/${P2POOL_VERSION}"; \
2025-08-14 20:37:30 -05:00
URL="$(curl -fsSL "${API}" | jq -r --arg re "${ARCH_RE}" '.assets[].browser_download_url | select(test("linux") and test($re))' | head -n1)"; \
test -n "${URL}"; echo "Downloading ${URL}"; \
curl -fsSL "${URL}" -o /tmp/p2pool.tgz; \
mkdir -p /out; tar -xzf /tmp/p2pool.tgz -C /out; \
BIN="$(find /out -maxdepth 1 -type f -name 'p2pool*' | head -n1)"; \
test -n "${BIN}"; install -m0755 "${BIN}" /out/p2pool
2025-08-14 00:34:13 -05:00
FROM ${DEBIAN_IMAGE}
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends ca-certificates; \
2025-08-14 20:37:30 -05:00
update-ca-certificates; rm -rf /var/lib/apt/lists/*
COPY --from=fetch /out/p2pool /usr/local/bin/p2pool
2025-08-14 20:37:30 -05:00
RUN /usr/local/bin/p2pool --version || true
EXPOSE 3333
2025-08-14 20:37:30 -05:00
ENTRYPOINT ["/usr/local/bin/p2pool"]