chore(docker): refine compose for named volume server deploy

Use a named SQLite volume, healthcheck, and clearer production env examples.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-06 10:20:27 +02:00
co-authored by Cursor
parent 2c5aa01a9a
commit 5e5a14030a
2 changed files with 28 additions and 7 deletions
+7 -5
View File
@@ -1,5 +1,7 @@
# Copy to .env.docker for docker compose (gitignored).
# Do not commit real secrets.
JWT_SECRET=replace-with-a-strong-secret
CORS_ORIGIN=http://localhost:5174
# Copy to .env.docker on the server (never commit real secrets).
#
# Required in production:
JWT_SECRET=replace-with-a-long-random-secret
#
# Frontend origin (your deployed Vue app URL):
CORS_ORIGIN=https://your-frontend-domain.example
+21 -2
View File
@@ -3,9 +3,10 @@ services:
build:
context: .
dockerfile: Dockerfile
image: child-gold-land-backend:latest
container_name: child-gold-land-backend
ports:
- "3000:3000"
- "${PORT:-3000}:3000"
env_file:
- .env.docker
environment:
@@ -14,5 +15,23 @@ services:
HOST: 0.0.0.0
DB_PATH: /app/data/app.db
volumes:
- ./docker-data:/app/data
# Persistent SQLite storage (WAL/SHM live here too).
# On server, replace with e.g. /var/lib/child-gold-land/data:/app/data
- sqlite_data:/app/data
restart: unless-stopped
healthcheck:
test:
[
"CMD",
"node",
"-e",
"fetch('http://127.0.0.1:3000/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))",
]
interval: 30s
timeout: 5s
retries: 3
start_period: 20s
volumes:
sqlite_data:
name: child-gold-land-sqlite