The production image is now a single Go binary that serves both the JSON/WebSocket API under /api and the Svelte dashboard at /. - New internal/webui package embeds a dist/ subdir via //go:embed. A placeholder index.html is committed so `go build` works on a fresh checkout; anything else in dist/ is regenerated per build and gitignored. - httpapi.Server.Handler mounts the embed.FS at / with SPA-style fallback: unknown non-/api paths serve index.html so client-side routes survive a reload. /api/* is carved out explicitly so POSTs or typos never accidentally shadow API semantics with HTML. - api/Dockerfile grows a node:22 builder stage that runs `npm ci && npm run build`, and the Go stage copies ui/dist/ into internal/webui/dist/ before `go build`. Build context moves to the repo root (docker-compose + `make api` both updated) so the Dockerfile can see both api/ and ui/. With this in place, `make up` brings the whole stack online at http://localhost:8080 — API under /api, dashboard at /. The Vite dev server on :5173 with the /api proxy is still available via `make ui-dev` for hot-reload development.
53 lines
1.5 KiB
Makefile
53 lines
1.5 KiB
Makefile
# ----------------------------------------------------------------------------
|
|
# Kamado Pool — top-level Makefile
|
|
# ----------------------------------------------------------------------------
|
|
.PHONY: help ckpool api api-test ckpool-shell ui ui-dev ui-check up down logs clean
|
|
|
|
help:
|
|
@echo "Kamado Pool targets:"
|
|
@echo " make ckpool Build the ckpool-solo docker image"
|
|
@echo " make api Build the kamado-api docker image"
|
|
@echo " make api-test Run Go tests for kamado-api (requires Go installed)"
|
|
@echo " make ui Build the Svelte UI to ui/dist (requires node)"
|
|
@echo " make ui-dev Run the Vite dev server on :5173 with /api proxy"
|
|
@echo " make ui-check Run svelte-check type diagnostics"
|
|
@echo " make ckpool-shell Open a shell in the built ckpool image"
|
|
@echo " make up docker compose up -d --build"
|
|
@echo " make down docker compose down"
|
|
@echo " make logs Tail ckpool + api logs"
|
|
@echo " make clean Remove build artifacts, data, and volumes"
|
|
|
|
ckpool:
|
|
docker build -t kamado/ckpool:dev ./ckpool
|
|
|
|
api:
|
|
docker build -t kamado/api:dev -f api/Dockerfile .
|
|
|
|
api-test:
|
|
cd api && go test ./... -race
|
|
|
|
ui:
|
|
cd ui && npm install && npm run build
|
|
|
|
ui-dev:
|
|
cd ui && npm install && npm run dev
|
|
|
|
ui-check:
|
|
cd ui && npm install && npm run check
|
|
|
|
ckpool-shell: ckpool
|
|
docker run --rm -it --entrypoint /bin/sh kamado/ckpool:dev
|
|
|
|
up:
|
|
docker compose up -d --build
|
|
|
|
down:
|
|
docker compose down
|
|
|
|
logs:
|
|
docker compose logs -f
|
|
|
|
clean:
|
|
docker compose down -v || true
|
|
rm -rf data/ build/ dist/
|