7467a8d30f
docker-compose.yml: two profiles.
- backend: backend (node+ws+better-sqlite3, /data volume) + frontend
(Caddy static build, STORAGE=ws, same-origin proxy)
- firebase: existing Dockerfile + nginx (upstream path, untouched)
Run: docker compose --profile backend up --build. OrbStack local now,
remote docker context later.
server/Dockerfile: node:18-alpine, workspaces (shared dep), rebuild
better-sqlite3 for musl, DB at /data/tracker.sqlite.
Dockerfile.ws: CRA build STORAGE=ws → caddy:2-alpine serves /srv.
No backend URL baked (same-origin).
Caddyfile: handle /api/* + handle /ws → backend:4001 (path preserved,
mutually-exclusive handles so try_files SPA fallback never shadows proxy).
handle { static try_files } last. HTTP basic auth block optional.
src/storage/ws.js: same-origin defaults. Empty baseUrl = relative fetch
(Caddy proxy). wsUrl derives from window.location (http→ws/https→wss).
Fallback localhost for bare npm start dev.
.dockerignore: add data/ scratch/ tmp/ (never bake into image). Keep
Caddyfile in context (frontend build COPYs it).
Smoke verified via OrbStack:
- GET / → 200 (static SPA)
- PUT/GET /api/doc roundtrip → JSON persists
- WS /ws subscribe + change push → both work through proxy
Firebase profile: pre-existing Dockerfile requires .env.local (hardcoded
COPY on main, not changed here). User must create file. Not a regression.
40 lines
701 B
Plaintext
40 lines
701 B
Plaintext
# Ignore Git directory
|
|
.git
|
|
.gitignore
|
|
|
|
# Ignore Node.js modules (they will be installed in the Docker image)
|
|
node_modules
|
|
**/node_modules
|
|
|
|
# Ignore build output (it will be generated in the Docker image)
|
|
build
|
|
dist
|
|
|
|
# Ignore Docker files themselves (Caddyfile MUST stay in context for frontend build)
|
|
Dockerfile
|
|
Dockerfile.ws
|
|
.dockerignore
|
|
docker-compose.yml
|
|
|
|
# Ignore any local environment files if you have them
|
|
.env
|
|
.env.local
|
|
.env.development.local
|
|
.env.test.local
|
|
.env.production.local
|
|
|
|
# Ignore IDE and OS-specific files
|
|
.vscode/
|
|
.idea
|
|
*.suo
|
|
*.user
|
|
*.userosscache
|
|
*.sln.docstates
|
|
Thumbs.db
|
|
.DS_Store
|
|
|
|
# Ignore local sqlite data + scratch diagnostics (never bake into image)
|
|
data/
|
|
scratch/
|
|
tmp/
|