Add a Dockerfile so the sync server is one command to deploy

Self-hosting meant building the binary by hand and wiring Postgres up
yourself. The image is a static binary on distroless with a built-in
healthcheck flag, and docker-compose brings up Postgres alongside it.

The image itself is unbuilt here: no container runtime is available in
this environment, so only the static Linux build and the healthcheck
flag have been exercised.

💘 Generated with Crush

Assisted-by: Crush:kimi-k3
This commit is contained in:
2026-10-08 10:23:54 +08:00
parent f3e6fc8fa6
commit cbdf5538aa
7 changed files with 132 additions and 3 deletions
+6 -3
View File
@@ -42,9 +42,12 @@ clicking an item copies it back to the clipboard.
code and server URL in `UserDefaults` (`sync.code`, `sync.serverURL`,
`sync.version`), pushes the whole store as JSON, and polls every 5s.
- `Server/main.go` — the Go sync backend (single file, `net/http` + `lib/pq`).
Also ships `Server/README.md` (self-hosting) and `Server/prompt-sync.service`
(systemd unit). Logs one line per request, creates its schema on startup, and
shuts down gracefully on SIGTERM so a redeploy cannot cut off a push.
Also ships `Server/Dockerfile` + `Server/docker-compose.yml` (Postgres +
server), `Server/README.md` (self-hosting), and `Server/prompt-sync.service`
(systemd unit). Logs one line per request, creates its schema on startup,
shuts down gracefully on SIGTERM so a redeploy cannot cut off a push, and
supports `-healthcheck` (pings local `/healthz`) so the distroless image
needs no shell for its Docker `HEALTHCHECK`.
## Sync protocol