feat(daemon): publishable Docker image + compose stack#36
Open
Codename-11 wants to merge 1 commit into
Open
Conversation
Ships `ghcr.io/axiom-labs/arc-daemon` for headless installs that want
a persistent daemon without the full CLI. The image runs
`arc-daemon --foreground` on :7272 as a non-root user (uid 1000) with
state at /home/arc/.arc, signals handled via tini, and a /health-based
HEALTHCHECK.
Adds:
- packages/daemon/src/cli.ts — standalone foreground entrypoint with a
tiny flag parser (--port/--host/--arc-dir). Registered as
`arc-daemon` bin and used as the image ENTRYPOINT.
- packages/daemon/tsup.config.ts — daemon-scoped build that inlines
workspace siblings and externalises real deps (ws, better-sqlite3,
zod) so Node's loader resolves CJS modules at runtime.
- packages/daemon/Dockerfile — multi-stage (node:20-bookworm-slim).
Stage 1 installs a filtered pnpm subgraph, rebuilds better-sqlite3,
runs `pnpm deploy --prod` for a pruned tree. Stage 2 is tini + curl
+ non-root user + VOLUME /home/arc/.arc.
- packages/daemon/.dockerignore — shrinks the build context.
- packages/daemon/docker-compose.yml — loopback-only daemon service
with an opt-in watchtower sidecar behind the `auto-update` profile.
- packages/daemon/DOCKER.md — operator guide: pull/run, port mapping,
volume semantics, security notes (loopback default, proxy for LAN).
- .github/workflows/docker-daemon.yml — GHCR publish on v* tags plus
workflow_dispatch, matrixed over linux/amd64 + linux/arm64 with a
manifest-merge job.
- packages/daemon/package.json — adds `@axiom-labs/arc-client` and
`ws` as explicit deps (previously transitive through client) and
registers `arc-daemon` as a bin entry.
E2E locally: `npx tsc --noEmit` passes and the built CLI serves the
expected `{"ok":true,"protocol":1,...}` payload on /health. Full
`docker build` unverified here — Docker Desktop's Linux engine isn't
running in this worktree; CI will exercise the full path.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the
ghcr.io/axiom-labs/arc-daemonDocker image + compose example for headless ARC installs. Runsarc-daemon --foregroundon :7272 as a non-root user with state mounted at/home/arc/.arc.packages/daemon/Dockerfile) — stage 1 installs a filtered pnpm subgraph (core,client,daemon), rebuildsbetter-sqlite3against the container Node, runstsup+pnpm deploy --prod. Stage 2 isnode:20-bookworm-slim+tini+curl, non-root uid 1000,VOLUME /home/arc/.arc, HEALTHCHECK probing/health.packages/daemon/src/cli.ts) — tiny flag parser (--port/--host/--arc-dir) used as the ENTRYPOINT and registered as thearc-daemonbin. The richerarc daemon startremains canonical.packages/daemon/tsup.config.ts) — daemon-scoped build that inlines workspace siblings and externalises real deps so Node can resolve CJS modules likews+better-sqlite3at runtime.auto-updateprofile..github/workflows/docker-daemon.yml) — pushes to GHCR onv*tags and onworkflow_dispatch; matrixed overlinux/amd64+linux/arm64with a manifest-merge job.@axiom-labs/arc-clientandws, which were previously leaking in as transitives.Does NOT wire an external DB, change the default port (7272), or publish the image (CI does that on tag).
Test plan
pnpm install— cleannpx tsc --noEmit— passespnpm --filter @axiom-labs/arc-daemon build— producesdist/cli.js+dist/index.jsnode dist/cli.js --foreground --port 17272 --host 127.0.0.1— daemon starts,curl /healthreturns{"ok":true,"protocol":1,...}, SIGTERM shuts down cleanlydocker build -f packages/daemon/Dockerfile -t arc-daemon:test .— unverified locally: Docker Desktop's Linux engine isn't running in this worktree. CI workflow will exercise it on the first manual dispatch.docker run+/healthround-trip — unverified locally (same reason)Notes for reviewers
--foregroundflag is accepted by the standalone bin for parity witharc daemon start, but the bin is always foreground (no daemonisation). That's documented in--helpand inDOCKER.md.ARC_HOST=0.0.0.0binds all interfaces, but the daemon's existing Host-header allowlist still requires127.0.0.1/localhost. Publishing with-p 127.0.0.1:7272:7272(the documented default) keeps access loopback-only on the host. LAN exposure requires a proxy that rewritesHost— called out inDOCKER.md.pnpm deploy --prod --legacyis used to produce a flat production tree without workspace symlinks. The--legacyflag is required on pnpm 10 because injected-workspace-packages conflicts with--prodpruning.