consuming custom images

This commit is contained in:
Brad Stein 2025-08-14 00:34:13 -05:00
parent d001fbcaf3
commit ca8b4fd6c3
5 changed files with 66 additions and 32 deletions

View File

@ -1,28 +1,59 @@
# syntax=docker/dockerfile:1.6 # syntax=docker/dockerfile:1.6
FROM debian:bookworm-slim
ARG P2POOL_VERSION=v4.9 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
ARG TARGETARCH ARG TARGETARCH
ARG P2POOL_SHA256="" ARG P2POOL_VERSION
RUN set -eux; \ RUN set -eux; \
apt-get update; \ apt-get update; \
apt-get install -y --no-install-recommends ca-certificates curl xz-utils tar; \ apt-get install -y --no-install-recommends ca-certificates curl jq xz-utils tar unzip; \
update-ca-certificates; \ update-ca-certificates; \
rm -rf /var/lib/apt/lists/*
RUN set -eux; \
case "${TARGETARCH:-arm64}" in \ case "${TARGETARCH:-arm64}" in \
amd64) ASUF="linux-x86_64" ;; \ amd64) ARCH_RE='(x86_64|amd64)';; \
arm64) ASUF="linux-arm64" ;; \ arm64) ARCH_RE='(arm64|aarch64|armv8)';; \
arm) ASUF="linux-arm" ;; \ arm) ARCH_RE='(arm|armv7|armhf)';; \
*) echo "Unsupported TARGETARCH=${TARGETARCH}"; exit 1 ;; \ *) echo "Unsupported TARGETARCH=${TARGETARCH}"; exit 1;; \
esac; \ esac; \
URL="https://github.com/SChernykh/p2pool/releases/download/${P2POOL_VERSION}/p2pool-${ASUF}.tar.gz"; \ API_URL="https://api.github.com/repos/SChernykh/p2pool/releases/tags/v${P2POOL_VERSION}"; \
echo "Downloading $URL"; \ ASSET_URL="$(curl -fsSL -H 'Accept: application/vnd.github+json' "$API_URL" \
curl -fL "$URL" -o /tmp/p2pool.tgz; \ | jq -r --arg re "$ARCH_RE" \
if [ -n "$P2POOL_SHA256" ]; then echo "${P2POOL_SHA256} /tmp/p2pool.tgz" | sha256sum -c -; fi; \ '.assets[] | select((.name|test("linux")) and (.name|test($re))) | .browser_download_url' \
tar -xzf /tmp/p2pool.tgz -C /usr/local/bin --wildcards 'p2pool*'; \ | head -n1)"; \
chmod 0755 /usr/local/bin/p2pool*; \ test -n "$ASSET_URL"; \
ln -sf /usr/local/bin/p2pool /usr/local/bin/p2pool; \ echo "Fetching $ASSET_URL"; \
rm -f /tmp/p2pool.tgz 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
EXPOSE 3333 EXPOSE 3333
CMD ["p2pool","--version"] ENTRYPOINT ["p2pool"]

View File

@ -353,6 +353,10 @@ function walletsvc_bootstrap --description "Interactive setup of monero-wallet-r
set daemon_addr monerod.crypto.svc.cluster.local:18081 set daemon_addr monerod.crypto.svc.cluster.local:18081
end end
echo "Daemon address (for the Deployment): $daemon_addr" echo "Daemon address (for the Deployment): $daemon_addr"
read -P "Override daemon address for this deployment? (host:port, blank to keep): " daemon_override
if test -n "$daemon_override"
set daemon_addr $daemon_override
end
if test -z "$WALLETSVC_SKIP_DAEMON_CHECK" if test -z "$WALLETSVC_SKIP_DAEMON_CHECK"
_banner "Probing daemon via temporary port-forward" _banner "Probing daemon via temporary port-forward"
@ -367,9 +371,9 @@ function walletsvc_bootstrap --description "Interactive setup of monero-wallet-r
echo "Skipping daemon probe due to WALLETSVC_SKIP_DAEMON_CHECK=1" echo "Skipping daemon probe due to WALLETSVC_SKIP_DAEMON_CHECK=1"
end end
# Public image that includes monero-wallet-rpc # Use your private image by default (in Zot)
read -P "Container image for wallet RPC [docker.io/sethsimmons/simple-monero-wallet-rpc:latest]: " image read -P "Container image for wallet RPC [registry.bstein.dev/infra/monero-wallet-rpc:0.18.4.1]: " image
if test -z "$image"; set image docker.io/sethsimmons/simple-monero-wallet-rpc:latest; end if test -z "$image"; set image registry.bstein.dev/infra/monero-wallet-rpc:0.18.4.1; end
_require "Container image" $image; or return 1 _require "Container image" $image; or return 1
# --- Secrets (defaults: RPC user=wallet name, passwords auto if missing) # --- Secrets (defaults: RPC user=wallet name, passwords auto if missing)

View File

@ -2,22 +2,22 @@
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: p2pool name: monero-p2pool
namespace: crypto namespace: crypto
labels: { app: p2pool } labels: { app: monero-p2pool }
spec: spec:
replicas: 1 replicas: 1
selector: selector:
matchLabels: { app: p2pool } matchLabels: { app: monero-p2pool }
template: template:
metadata: metadata:
labels: { app: p2pool } labels: { app: monero-p2pool }
spec: spec:
nodeSelector: nodeSelector:
node-role.kubernetes.io/worker: "true" node-role.kubernetes.io/worker: "true"
containers: containers:
- name: p2pool - name: monero-p2pool
image: ghcr.io/sethforprivacy/p2pool:latest image: registry.bstein.dev/infra/monero-p2pool:4.9
command: ["p2pool"] command: ["p2pool"]
args: args:
- "--host" - "--host"

View File

@ -2,7 +2,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1 apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization kind: Kustomization
resources: resources:
- secret-wallet.yaml
- configmap-sources.yaml - configmap-sources.yaml
- deployment.yaml - deployment.yaml
- service.yaml - service.yaml

View File

@ -1,16 +1,16 @@
apiVersion: apps/v1 apiVersion: apps/v1
kind: DaemonSet kind: DaemonSet
metadata: metadata:
name: xmr-xmrig name: monero-xmrig
namespace: crypto namespace: crypto
labels: { app: xmr-xmrig } labels: { app: monero-xmrig }
spec: spec:
selector: selector:
matchLabels: { app: xmr-xmrig } matchLabels: { app: monero-xmrig }
updateStrategy: { type: RollingUpdate } updateStrategy: { type: RollingUpdate }
template: template:
metadata: metadata:
labels: { app: xmr-xmrig } labels: { app: monero-xmrig }
spec: spec:
priorityClassName: scavenger priorityClassName: scavenger
nodeSelector: nodeSelector:
@ -18,7 +18,7 @@ spec:
volumes: volumes:
- name: payout - name: payout
secret: secret:
secretName: xmr-payout secretName: monero-payout
containers: containers:
- name: xmrig - name: xmrig
image: ghcr.io/tari-project/xmrig:latest image: ghcr.io/tari-project/xmrig:latest