- Remove version: '3.8' from docker-compose.prod.yml - Convert healthcheck test to JSON array form - Quote port mappings in prod - Remove stray blank line after header in docker-compose.yml
83 lines
1.7 KiB
YAML
83 lines
1.7 KiB
YAML
services:
|
|
backend:
|
|
build:
|
|
context: ./backend
|
|
dockerfile: Dockerfile
|
|
target: production
|
|
environment:
|
|
- NODE_ENV=production
|
|
- DATABASE_PATH=/app/database/data/edh-stats.db
|
|
- JWT_SECRET_FILE=/run/secrets/jwt_secret
|
|
- CORS_ORIGIN=${CORS_ORIGIN:-https://yourdomain.com}
|
|
- LOG_LEVEL=warn
|
|
- RATE_LIMIT_WINDOW=15
|
|
- RATE_LIMIT_MAX=100
|
|
- ALLOW_REGISTRATION=${ALLOW_REGISTRATION:-false}
|
|
volumes:
|
|
- sqlite_data:/app/database/data
|
|
- app_logs:/app/logs
|
|
secrets:
|
|
- jwt_secret
|
|
restart: unless-stopped
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 512M
|
|
cpus: '0.5'
|
|
reservations:
|
|
memory: 256M
|
|
cpus: '0.25'
|
|
healthcheck:
|
|
test:
|
|
[
|
|
'CMD',
|
|
'wget',
|
|
'--no-verbose',
|
|
'--tries=1',
|
|
'--spider',
|
|
'http://localhost:3000/api/health'
|
|
]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 40s
|
|
networks:
|
|
- edh-stats-network
|
|
stop_grace_period: 30s
|
|
|
|
frontend:
|
|
image: nginx:alpine
|
|
volumes:
|
|
- ./frontend/nginx.prod.conf:/etc/nginx/nginx.conf:ro
|
|
- ./frontend/public:/usr/share/nginx/html:ro
|
|
ports:
|
|
- '80:80'
|
|
- '443:443'
|
|
restart: unless-stopped
|
|
networks:
|
|
- edh-stats-network
|
|
|
|
# Optional: Add reverse proxy for SSL termination
|
|
# nginx-proxy:
|
|
# image: nginx:alpine
|
|
# ports:
|
|
# - "443:443"
|
|
# volumes:
|
|
# - ./ssl:/etc/nginx/ssl:ro
|
|
# depends_on:
|
|
# - frontend
|
|
|
|
volumes:
|
|
sqlite_data:
|
|
driver: local
|
|
app_logs:
|
|
driver: local
|
|
|
|
secrets:
|
|
jwt_secret:
|
|
external: true
|
|
|
|
networks:
|
|
edh-stats-network:
|
|
driver: bridge
|