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:
+7
-5
@@ -1,5 +1,7 @@
|
|||||||
# Copy to .env.docker for docker compose (gitignored).
|
# Copy to .env.docker on the server (never commit real secrets).
|
||||||
# Do not commit real secrets.
|
#
|
||||||
|
# Required in production:
|
||||||
JWT_SECRET=replace-with-a-strong-secret
|
JWT_SECRET=replace-with-a-long-random-secret
|
||||||
CORS_ORIGIN=http://localhost:5174
|
#
|
||||||
|
# Frontend origin (your deployed Vue app URL):
|
||||||
|
CORS_ORIGIN=https://your-frontend-domain.example
|
||||||
|
|||||||
+21
-2
@@ -3,9 +3,10 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
|
image: child-gold-land-backend:latest
|
||||||
container_name: child-gold-land-backend
|
container_name: child-gold-land-backend
|
||||||
ports:
|
ports:
|
||||||
- "3000:3000"
|
- "${PORT:-3000}:3000"
|
||||||
env_file:
|
env_file:
|
||||||
- .env.docker
|
- .env.docker
|
||||||
environment:
|
environment:
|
||||||
@@ -14,5 +15,23 @@ services:
|
|||||||
HOST: 0.0.0.0
|
HOST: 0.0.0.0
|
||||||
DB_PATH: /app/data/app.db
|
DB_PATH: /app/data/app.db
|
||||||
volumes:
|
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
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user