Align Dockerfile and entrypoint with upstream KamadoPool build
Previous scaffold referenced a non-existent 'make ckpool-src' target. Rewritten to inline the real build steps from the upstream KamadoPool repo: clone ckpool at CKPOOL_COMMIT, apply patches/*.patch, build with the same portable CFLAGS the ckpool Dockerfile uses. The ui and api stages now match api/Dockerfile exactly. Entrypoint now uses the same env-var interface as the upstream ckpool entrypoint (POOL_BTCADDRESS, BITCOIN_RPC_*, STRATUM_PORT, etc.) and renders ckpool.conf from the bundled template via sed. kamado-api env vars corrected to match config.FromEnv (BITCOIN_RPC_URL, CKPOOL_SOCKDIR, CKPOOL_LOGFILE, LISTEN_ADDR).
This commit is contained in:
+40
-20
@@ -2,19 +2,22 @@
|
||||
#
|
||||
# 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.
|
||||
# Clones the KamadoPool repo at a pinned SHA, then inlines the ckpool,
|
||||
# ui, and api build stages (mirroring ckpool/Dockerfile and api/Dockerfile
|
||||
# in the upstream repo). Final runtime image has both binaries plus the
|
||||
# StartOS entrypoint that supervises them.
|
||||
#
|
||||
# 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.
|
||||
# TODO: set KAMADO_SHA to a real pushed commit before running `make`.
|
||||
# The placeholder below is a valid 40-char hex string to keep tooling
|
||||
# happy but the clone checkout will fail until this is updated.
|
||||
|
||||
ARG KAMADO_REPO=https://github.com/Relaxo143/KamadoPool.git
|
||||
ARG KAMADO_SHA=0000000000000000000000000000000000000000
|
||||
ARG CKPOOL_REPO=https://bitbucket.org/ckolivas/ckpool.git
|
||||
ARG CKPOOL_COMMIT=cfb0f83b70d7b382b85d2bd0710cf4cb2dda4007
|
||||
ARG ARCH
|
||||
|
||||
# ---------- stage 1: fetch source ----------
|
||||
# ---------- stage 1: fetch Kamado source ----------
|
||||
FROM debian:bookworm-slim AS source
|
||||
ARG KAMADO_REPO
|
||||
ARG KAMADO_SHA
|
||||
@@ -25,22 +28,34 @@ WORKDIR /src
|
||||
RUN git clone "${KAMADO_REPO}" kamado \
|
||||
&& cd kamado && git checkout "${KAMADO_SHA}"
|
||||
|
||||
# ---------- stage 2: build ckpool ----------
|
||||
# ---------- stage 2: build patched ckpool ----------
|
||||
# Mirrors KamadoPool/ckpool/Dockerfile: clones upstream ckpool at the
|
||||
# pinned commit, applies Kamado patches, builds with portable CFLAGS.
|
||||
FROM debian:bookworm-slim AS ckpool-build
|
||||
ARG CKPOOL_REPO
|
||||
ARG CKPOOL_COMMIT
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
build-essential autoconf automake libtool pkg-config \
|
||||
yasm libzmq3-dev git ca-certificates \
|
||||
libzmq3-dev ca-certificates git \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
COPY --from=source /src/kamado /src/kamado
|
||||
WORKDIR /src/kamado
|
||||
RUN make ckpool-src \
|
||||
&& cd ckpool/src \
|
||||
WORKDIR /build
|
||||
RUN git clone "${CKPOOL_REPO}" ckpool \
|
||||
&& cd ckpool && git checkout "${CKPOOL_COMMIT}"
|
||||
COPY --from=source /src/kamado/ckpool/patches/ /tmp/kamado-patches/
|
||||
RUN set -eux; cd /build/ckpool; \
|
||||
for p in /tmp/kamado-patches/*.patch; do \
|
||||
[ -f "$p" ] || continue; \
|
||||
echo "Applying $(basename "$p")"; \
|
||||
git apply --verbose "$p"; \
|
||||
done
|
||||
RUN cd /build/ckpool \
|
||||
&& ./autogen.sh \
|
||||
&& ./configure --without-ckdb --prefix=/usr/local \
|
||||
&& make -j"$(nproc)" \
|
||||
&& install -Dm755 src/ckpool /out/usr/local/bin/ckpool
|
||||
&& CFLAGS="-O2 -Wall -pipe" ./configure --prefix=/usr/local \
|
||||
&& make -j"$(nproc)"
|
||||
RUN install -Dm755 /build/ckpool/src/ckpool /out/usr/local/bin/ckpool \
|
||||
&& install -Dm755 /build/ckpool/src/ckpmsg /out/usr/local/bin/ckpmsg
|
||||
|
||||
# ---------- stage 3: build UI ----------
|
||||
# ---------- stage 3: build the Svelte UI ----------
|
||||
FROM node:22-bookworm-slim AS ui-build
|
||||
WORKDIR /ui
|
||||
COPY --from=source /src/kamado/ui/package.json ./
|
||||
@@ -48,9 +63,11 @@ 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 ----------
|
||||
# ---------- stage 4: build the Go api with embedded UI ----------
|
||||
FROM golang:1.22-bookworm AS api-build
|
||||
WORKDIR /src
|
||||
COPY --from=source /src/kamado/api/go.mod ./
|
||||
RUN go mod download 2>/dev/null || true
|
||||
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/
|
||||
@@ -66,7 +83,7 @@ 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
|
||||
# yq for reading StartOS config.yaml in the entrypoint
|
||||
RUN set -eu; \
|
||||
case "${ARCH}" in \
|
||||
x86_64|amd64) YQ_ARCH=amd64 ;; \
|
||||
@@ -78,9 +95,12 @@ RUN set -eu; \
|
||||
chmod +x /usr/local/bin/yq
|
||||
|
||||
COPY --from=ckpool-build /out/usr/local/bin/ckpool /usr/local/bin/ckpool
|
||||
COPY --from=ckpool-build /out/usr/local/bin/ckpmsg /usr/local/bin/ckpmsg
|
||||
COPY --from=api-build /out/kamado-api /usr/local/bin/kamado-api
|
||||
COPY --from=source /src/kamado/ckpool/config/ckpool.conf.template /etc/ckpool/ckpool.conf.template
|
||||
COPY docker_entrypoint.sh /usr/local/bin/docker_entrypoint.sh
|
||||
RUN chmod +x /usr/local/bin/docker_entrypoint.sh
|
||||
RUN chmod +x /usr/local/bin/docker_entrypoint.sh \
|
||||
&& mkdir -p /run/ckpool /var/log/ckpool /var/lib/kamado
|
||||
|
||||
EXPOSE 3333 8080
|
||||
WORKDIR /root
|
||||
|
||||
Reference in New Issue
Block a user