consuming custom images
This commit is contained in:
parent
ca8b4fd6c3
commit
b891ed7f72
@ -1,11 +1,7 @@
|
|||||||
# syntax=docker/dockerfile:1.6
|
# syntax=docker/dockerfile:1.6
|
||||||
|
|
||||||
ARG DEBIAN_IMAGE=debian:bookworm-slim
|
ARG DEBIAN_IMAGE=debian:bookworm-slim
|
||||||
ARG P2POOL_VERSION=4.9
|
ARG P2POOL_VERSION=v4.9
|
||||||
|
|
||||||
################################################################################
|
|
||||||
# Stage: fetch — download & extract the right release asset, normalize to /opt/bin/p2pool
|
|
||||||
################################################################################
|
|
||||||
FROM ${DEBIAN_IMAGE} AS fetch
|
FROM ${DEBIAN_IMAGE} AS fetch
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
ARG P2POOL_VERSION
|
ARG P2POOL_VERSION
|
||||||
@ -16,6 +12,7 @@ RUN set -eux; \
|
|||||||
update-ca-certificates; \
|
update-ca-certificates; \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Pick the correct asset URL for our arch from the release metadata
|
||||||
RUN set -eux; \
|
RUN set -eux; \
|
||||||
case "${TARGETARCH:-arm64}" in \
|
case "${TARGETARCH:-arm64}" in \
|
||||||
amd64) ARCH_RE='(x86_64|amd64)';; \
|
amd64) ARCH_RE='(x86_64|amd64)';; \
|
||||||
@ -23,37 +20,28 @@ RUN set -eux; \
|
|||||||
arm) ARCH_RE='(arm|armv7|armhf)';; \
|
arm) ARCH_RE='(arm|armv7|armhf)';; \
|
||||||
*) echo "Unsupported TARGETARCH=${TARGETARCH}"; exit 1;; \
|
*) echo "Unsupported TARGETARCH=${TARGETARCH}"; exit 1;; \
|
||||||
esac; \
|
esac; \
|
||||||
API_URL="https://api.github.com/repos/SChernykh/p2pool/releases/tags/v${P2POOL_VERSION}"; \
|
API="https://api.github.com/repos/SChernykh/p2pool/releases/tags/${P2POOL_VERSION}"; \
|
||||||
ASSET_URL="$(curl -fsSL -H 'Accept: application/vnd.github+json' "$API_URL" \
|
URL="$(curl -fsSL "$API" | jq -r --arg re "$ARCH_RE" \
|
||||||
| jq -r --arg re "$ARCH_RE" \
|
'.assets[] | select((.name|test("linux")) and (.name|test($re))) | .browser_download_url' | head -n1)"; \
|
||||||
'.assets[] | select((.name|test("linux")) and (.name|test($re))) | .browser_download_url' \
|
test -n "$URL"; \
|
||||||
| head -n1)"; \
|
echo "Downloading $URL"; \
|
||||||
test -n "$ASSET_URL"; \
|
mkdir -p /tmp/p2pool; \
|
||||||
echo "Fetching $ASSET_URL"; \
|
curl -fsSL "$URL" -o /tmp/p2pool/p2pool.tar; \
|
||||||
curl -fL "$ASSET_URL" -o /tmp/p2pool.pkg; \
|
# try both common formats
|
||||||
mkdir -p /tmp/ex && cd /tmp/ex; \
|
( tar -xOf /tmp/p2pool/p2pool.tar >/dev/null 2>&1 && tar -xf /tmp/p2pool/p2pool.tar -C /tmp/p2pool ) \
|
||||||
case "$ASSET_URL" in \
|
|| ( tar -xzf /tmp/p2pool/p2pool.tar -C /tmp/p2pool || tar -xJf /tmp/p2pool/p2pool.tar -C /tmp/p2pool ); \
|
||||||
*.tar.xz) tar -xJf /tmp/p2pool.pkg ;; \
|
# find the p2pool binary and install as a stable name
|
||||||
*.tar.gz) tar -xzf /tmp/p2pool.pkg ;; \
|
P="$(find /tmp/p2pool -maxdepth 2 -type f -name 'p2pool' | head -n1)"; \
|
||||||
*.zip) unzip -q /tmp/p2pool.pkg ;; \
|
test -n "$P"; \
|
||||||
*) echo "Unknown archive format: $ASSET_URL"; exit 1 ;; \
|
install -m 0755 "$P" /usr/local/bin/p2pool
|
||||||
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}
|
FROM ${DEBIAN_IMAGE}
|
||||||
RUN set -eux; \
|
RUN set -eux; \
|
||||||
apt-get update; \
|
apt-get update; \
|
||||||
apt-get install -y --no-install-recommends ca-certificates; \
|
apt-get install -y --no-install-recommends ca-certificates; \
|
||||||
update-ca-certificates; \
|
update-ca-certificates; \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
COPY --from=fetch /usr/local/bin/p2pool /usr/local/bin/p2pool
|
||||||
COPY --from=fetch /opt/bin/p2pool /usr/local/bin/p2pool
|
|
||||||
|
|
||||||
EXPOSE 3333
|
EXPOSE 3333
|
||||||
ENTRYPOINT ["p2pool"]
|
ENTRYPOINT ["p2pool"]
|
||||||
|
|||||||
@ -1,30 +1,36 @@
|
|||||||
# syntax=docker/dockerfile:1.6
|
# syntax=docker/dockerfile:1.6
|
||||||
FROM debian:bookworm-slim
|
ARG DEBIAN_IMAGE=debian:bookworm-slim
|
||||||
|
|
||||||
ARG MONERO_VERSION=v0.18.4.1
|
ARG MONERO_VERSION=v0.18.4.1
|
||||||
|
|
||||||
|
FROM ${DEBIAN_IMAGE}
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
ARG MONERO_SHA256=""
|
ARG MONERO_VERSION
|
||||||
|
|
||||||
RUN set -eux; \
|
RUN set -eux; \
|
||||||
apt-get update; \
|
apt-get update; \
|
||||||
apt-get install -y --no-install-recommends ca-certificates curl bzip2; \
|
apt-get install -y --no-install-recommends ca-certificates curl bzip2; \
|
||||||
update-ca-certificates; \
|
update-ca-certificates; \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN set -eux; \
|
||||||
case "${TARGETARCH:-arm64}" in \
|
case "${TARGETARCH:-arm64}" in \
|
||||||
amd64) F="monero-linux-x64" ;; \
|
amd64) F="monero-linux-x64" ;; \
|
||||||
arm64) F="monero-linux-armv8" ;; \
|
arm64) F="monero-linux-armv8" ;; \
|
||||||
arm) F="monero-linux-armv7" ;; \
|
arm) F="monero-linux-armv7" ;; \
|
||||||
*) echo "Unsupported TARGETARCH=${TARGETARCH}"; exit 1 ;; \
|
*) echo "Unsupported TARGETARCH=${TARGETARCH}"; exit 1 ;; \
|
||||||
esac; \
|
esac; \
|
||||||
URL="https://downloads.getmonero.org/cli/${F}-${MONERO_VERSION}.tar.bz2"; \
|
URL="https://downloads.getmonero.org/cli/${F}-${MONERO_VERSION}.tar.bz2"; \
|
||||||
echo "Downloading $URL"; \
|
echo "Downloading $URL"; \
|
||||||
curl -fL "$URL" -o /tmp/monero.tar.bz2; \
|
|
||||||
if [ -n "$MONERO_SHA256" ]; then echo "${MONERO_SHA256} /tmp/monero.tar.bz2" | sha256sum -c -; fi; \
|
|
||||||
mkdir -p /opt/monero; \
|
mkdir -p /opt/monero; \
|
||||||
tar -xjf /tmp/monero.tar.bz2 -C /opt/monero --strip-components=1; \
|
curl -fsSL "$URL" -o /opt/monero/monero.tar.bz2; \
|
||||||
rm -f /tmp/monero.tar.bz2; \
|
tar -xjf /opt/monero/monero.tar.bz2 -C /opt/monero --strip-components=1; \
|
||||||
mkdir -p /data
|
rm -f /opt/monero/monero.tar.bz2; \
|
||||||
|
install -m 0755 /opt/monero/monero-* /usr/local/bin/ || true; \
|
||||||
|
install -m 0755 /opt/monero/monerod /usr/local/bin/ || true; \
|
||||||
|
install -m 0755 /opt/monero/monero-wallet-rpc /usr/local/bin/
|
||||||
|
|
||||||
ENV LD_LIBRARY_PATH=/opt/monero:/opt/monero/lib \
|
RUN /usr/local/bin/monero-wallet-rpc --version || true
|
||||||
PATH="/opt/monero:${PATH}"
|
|
||||||
|
EXPOSE 18083
|
||||||
|
ENTRYPOINT ["monero-wallet-rpc"]
|
||||||
|
|
||||||
CMD ["monero-wallet-rpc","--version"]
|
|
||||||
|
|||||||
@ -512,7 +512,7 @@ function walletsvc_bootstrap --description "Interactive setup of monero-wallet-r
|
|||||||
echo " containers:"
|
echo " containers:"
|
||||||
echo " - name: wallet-rpc"
|
echo " - name: wallet-rpc"
|
||||||
echo " image: $image"
|
echo " image: $image"
|
||||||
echo " imagePullPolicy: IfNotPresent"
|
echo " imagePullPolicy: Always"
|
||||||
echo " command: [\"/bin/sh\",\"-lc\"]"
|
echo " command: [\"/bin/sh\",\"-lc\"]"
|
||||||
echo " args:"
|
echo " args:"
|
||||||
echo " - |"
|
echo " - |"
|
||||||
|
|||||||
@ -18,6 +18,7 @@ spec:
|
|||||||
containers:
|
containers:
|
||||||
- name: monero-p2pool
|
- name: monero-p2pool
|
||||||
image: registry.bstein.dev/infra/monero-p2pool:4.9
|
image: registry.bstein.dev/infra/monero-p2pool:4.9
|
||||||
|
imagePullPolicy: Always
|
||||||
command: ["p2pool"]
|
command: ["p2pool"]
|
||||||
args:
|
args:
|
||||||
- "--host"
|
- "--host"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user