Files
KamadoPool-StartOS-0351/Dockerfile
T
satoshi 54935bf638 Add configurable stratum port (default 3333)
Exposes stratum-port in the StartOS config UI so users running
simpleproxy or another TCP forwarder can point Kamado at a
non-default port. Entrypoint substitutes the value into
ckpool.conf serverurl.

Also pins placeholder KAMADO_SHA in the Dockerfile — swap to a
real pushed commit before the first build.
2026-04-13 03:54:49 +03:00

88 lines
3.1 KiB
Docker

# 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=0000000000000000000000000000000000000000
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"]