diff --git a/Dockerfile b/Dockerfile index 3fde11d..f1088a4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,31 +2,24 @@ # # Kamado Pool StartOS package image. # -# 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. +# KamadoPool source is supplied via a named build context so the image +# is built from the local checkout (no GitHub, no pinned SHA). The +# Makefile passes `--build-context kamado=../KamadoPool` — adjust if +# your checkout lives elsewhere. # -# 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. +# After the source stage, the ckpool/ui/api build steps mirror the +# stages in KamadoPool's own ckpool/Dockerfile and api/Dockerfile. -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 Kamado 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 1: materialize Kamado source ---------- +# `kamado` is a named build context — the Makefile passes +# --build-context kamado=../KamadoPool so this COPY pulls directly +# from the local checkout. +FROM scratch AS source +COPY --from=kamado . /src/kamado/ # ---------- stage 2: build patched ckpool ---------- # Mirrors KamadoPool/ckpool/Dockerfile: clones upstream ckpool at the diff --git a/Makefile b/Makefile index ebe94c6..1478189 100644 --- a/Makefile +++ b/Makefile @@ -19,10 +19,13 @@ $(PKG_ID).s9pk: manifest.yaml instructions.md icon.png LICENSE scripts/embassy.j scripts/embassy.js: $(TS_FILES) deno run --allow-read --allow-write --allow-env --allow-net scripts/bundle.ts +KAMADO_SRC ?= ../KamadoPool + image.tar: Dockerfile docker_entrypoint.sh docker buildx build --tag start9/$(PKG_ID)/main:$(PKG_VERSION) \ --platform=linux/arm64/v8,linux/amd64 \ --build-arg ARCH=$(shell uname -m) \ + --build-context kamado=$(KAMADO_SRC) \ -o type=oci,dest=image.tar . clean: diff --git a/README.md b/README.md index 9f81286..9736938 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,11 @@ make This runs `deno` to bundle the embassy TypeScript procedures, builds a multi-arch OCI image via `docker buildx`, and packs everything into `kamado-pool.s9pk` using `start-sdk`. -> **Note:** the Dockerfile clones the Kamado source from a pinned git SHA. Before the first build, set the `KAMADO_REPO` and `KAMADO_SHA` build args in [Dockerfile](Dockerfile) to a real pushed commit on the upstream repo. +The build pulls KamadoPool source from a **local sibling checkout** (`../KamadoPool` by default) via a docker buildx named build context — no GitHub clone, no pinned SHA. If your checkout lives elsewhere, override it: + +```sh +make KAMADO_SRC=/path/to/KamadoPool +``` ## Install