Initial StartOS 0.3.5.1 packaging scaffold for Kamado Pool

Multi-stage Dockerfile clones KamadoPool at a pinned SHA, builds
ckpool and kamado-api (with embedded Svelte UI), runtime image
supervises both processes via tini + wait -n. Config covers
bitcoind mainnet/testnet4 variant, payout address, coinbase tag,
vardiff knobs, and log level. Web UI interface only — stratum
:3333 requires a router port-forward or simpleproxy workaround
because StartOS 0.3.x does not forward raw TCP on LAN.

TODO before first build: pin KAMADO_REPO + KAMADO_SHA in the
Dockerfile to a pushed commit.
This commit is contained in:
satoshi
2026-04-13 03:51:23 +03:00
commit 4064f9e56a
18 changed files with 689 additions and 0 deletions
+87
View File
@@ -0,0 +1,87 @@
# syntax=docker/dockerfile:1.6
#
# Kamado Pool StartOS package image.
#
# Clones KamadoPool at a pinned SHA, builds the patched ckpool-solo
# binary, builds the Go api binary with embedded Svelte UI, then
# assembles a small runtime image that supervises both processes.
#
# TODO: set KAMADO_REPO + KAMADO_SHA to a pushed commit before
# running `make` — the defaults below are placeholders and the build
# WILL fail until the KamadoPool source repo is pushed to GitHub.
ARG KAMADO_REPO=https://github.com/Relaxo143/KamadoPool.git
ARG KAMADO_SHA=REPLACE_ME_WITH_PUSHED_COMMIT_SHA
ARG ARCH
# ---------- stage 1: fetch source ----------
FROM debian:bookworm-slim AS source
ARG KAMADO_REPO
ARG KAMADO_SHA
RUN apt-get update && apt-get install -y --no-install-recommends \
git ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /src
RUN git clone "${KAMADO_REPO}" kamado \
&& cd kamado && git checkout "${KAMADO_SHA}"
# ---------- stage 2: build ckpool ----------
FROM debian:bookworm-slim AS ckpool-build
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential autoconf automake libtool pkg-config \
yasm libzmq3-dev git ca-certificates \
&& rm -rf /var/lib/apt/lists/*
COPY --from=source /src/kamado /src/kamado
WORKDIR /src/kamado
RUN make ckpool-src \
&& cd ckpool/src \
&& ./autogen.sh \
&& ./configure --without-ckdb --prefix=/usr/local \
&& make -j"$(nproc)" \
&& install -Dm755 src/ckpool /out/usr/local/bin/ckpool
# ---------- stage 3: build UI ----------
FROM node:22-bookworm-slim AS ui-build
WORKDIR /ui
COPY --from=source /src/kamado/ui/package.json ./
RUN npm install --no-audit --no-fund
COPY --from=source /src/kamado/ui/ ./
RUN npm run build
# ---------- stage 4: build Go api with embedded UI ----------
FROM golang:1.22-bookworm AS api-build
WORKDIR /src
COPY --from=source /src/kamado/api/ ./
RUN rm -rf internal/webui/dist && mkdir -p internal/webui/dist
COPY --from=ui-build /ui/dist/ internal/webui/dist/
RUN CGO_ENABLED=0 GOOS=linux go build \
-trimpath -ldflags="-s -w" \
-o /out/kamado-api ./cmd/kamado-api
# ---------- stage 5: runtime ----------
FROM debian:bookworm-slim AS runtime
ARG ARCH
ARG YQ_VERSION=v4.44.3
RUN apt-get update && apt-get install -y --no-install-recommends \
tini ca-certificates curl libzmq5 \
&& rm -rf /var/lib/apt/lists/*
# yq for parsing StartOS config.yaml inside the entrypoint
RUN set -eu; \
case "${ARCH}" in \
x86_64|amd64) YQ_ARCH=amd64 ;; \
aarch64|arm64) YQ_ARCH=arm64 ;; \
*) echo "unsupported arch: ${ARCH}" >&2; exit 1 ;; \
esac; \
curl -fsSL -o /usr/local/bin/yq \
"https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_${YQ_ARCH}"; \
chmod +x /usr/local/bin/yq
COPY --from=ckpool-build /out/usr/local/bin/ckpool /usr/local/bin/ckpool
COPY --from=api-build /out/kamado-api /usr/local/bin/kamado-api
COPY docker_entrypoint.sh /usr/local/bin/docker_entrypoint.sh
RUN chmod +x /usr/local/bin/docker_entrypoint.sh
EXPOSE 3333 8080
WORKDIR /root
ENTRYPOINT ["/usr/bin/tini", "--", "/usr/local/bin/docker_entrypoint.sh"]