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
+37
View File
@@ -0,0 +1,37 @@
# Postgres + the sync server. `docker compose up -d` is the whole deploy:
#
# POSTGRES_PASSWORD=$(openssl rand -hex 16) docker compose up -d
#
# Then point the app at http://<host>:8080. The data lives in the named volume,
# so `docker compose down` keeps it and `down -v` wipes it.
services:
db:
image: postgres:18-alpine
environment:
POSTGRES_DB: prompt_sync
POSTGRES_USER: prompt
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD}
volumes:
- prompt-db:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U prompt -d prompt_sync"]
interval: 5s
timeout: 5s
retries: 10
restart: unless-stopped
server:
build: .
environment:
PROMPT_SYNC_ADDR: ":8080"
PROMPT_SYNC_DATABASE_URL: postgres://prompt:${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD}@db:5432/prompt_sync?sslmode=disable
ports:
- "8080:8080"
depends_on:
db:
condition: service_healthy
restart: unless-stopped
volumes:
prompt-db: