feat(docker): add nginx frontend image and full-stack compose
Build static assets with Vite, proxy /api to backend, and document server env vars. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
services:
|
||||
backend:
|
||||
build:
|
||||
context: ../backend-nest
|
||||
dockerfile: Dockerfile
|
||||
image: child-gold-land-backend:latest
|
||||
container_name: child-gold-land-backend
|
||||
env_file:
|
||||
- .env.docker
|
||||
environment:
|
||||
NODE_ENV: production
|
||||
PORT: 3000
|
||||
HOST: 0.0.0.0
|
||||
DB_PATH: /app/data/app.db
|
||||
JWT_SECRET: ${JWT_SECRET}
|
||||
CORS_ORIGIN: ${CORS_ORIGIN}
|
||||
volumes:
|
||||
- backend_sqlite:/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
|
||||
networks:
|
||||
- child-gold-land
|
||||
|
||||
frontend:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
args:
|
||||
VITE_API_URL: ${VITE_API_URL:-/api}
|
||||
image: child-gold-land-frontend:latest
|
||||
container_name: child-gold-land-frontend
|
||||
ports:
|
||||
- "${FRONTEND_PORT:-8080}:80"
|
||||
depends_on:
|
||||
backend:
|
||||
condition: service_healthy
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- child-gold-land
|
||||
|
||||
volumes:
|
||||
backend_sqlite:
|
||||
name: child-gold-land-sqlite
|
||||
|
||||
networks:
|
||||
child-gold-land:
|
||||
name: child-gold-land
|
||||
Reference in New Issue
Block a user