83 lines
2.2 KiB
YAML
83 lines
2.2 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
container_name: feuerwehr_db_prod
|
|
environment:
|
|
POSTGRES_DB: ${POSTGRES_DB:-feuerwehr_prod}
|
|
POSTGRES_USER: ${POSTGRES_USER:-prod_user}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD is required}
|
|
ports:
|
|
- "${POSTGRES_PORT:-5432}:5432"
|
|
volumes:
|
|
- postgres_data_prod:/var/lib/postgresql/data
|
|
- ./backend/src/database/migrations:/docker-entrypoint-initdb.d:ro
|
|
networks:
|
|
- feuerwehr_network
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-prod_user} -d ${POSTGRES_DB:-feuerwehr_prod}"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 10s
|
|
restart: unless-stopped
|
|
|
|
backend:
|
|
build:
|
|
context: ./backend
|
|
dockerfile: Dockerfile
|
|
container_name: feuerwehr_backend_prod
|
|
environment:
|
|
NODE_ENV: production
|
|
DATABASE_URL: postgresql://${POSTGRES_USER:-prod_user}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB:-feuerwehr_prod}
|
|
PORT: 3000
|
|
JWT_SECRET: ${JWT_SECRET:?JWT_SECRET is required}
|
|
CORS_ORIGIN: ${CORS_ORIGIN:-http://localhost:80}
|
|
ports:
|
|
- "${BACKEND_PORT:-3000}:3000"
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
networks:
|
|
- feuerwehr_network
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:3000/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 40s
|
|
restart: unless-stopped
|
|
|
|
frontend:
|
|
build:
|
|
context: ./frontend
|
|
dockerfile: Dockerfile
|
|
args:
|
|
VITE_API_URL: ${VITE_API_URL:-http://localhost:3000}
|
|
container_name: feuerwehr_frontend_prod
|
|
environment:
|
|
VITE_API_URL: ${VITE_API_URL:-http://localhost:3000}
|
|
ports:
|
|
- "${FRONTEND_PORT:-80}:80"
|
|
depends_on:
|
|
backend:
|
|
condition: service_healthy
|
|
networks:
|
|
- feuerwehr_network
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:80"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 30s
|
|
restart: unless-stopped
|
|
|
|
volumes:
|
|
postgres_data_prod:
|
|
driver: local
|
|
|
|
networks:
|
|
feuerwehr_network:
|
|
driver: bridge
|