version: '3.8' services: # PostgreSQL Database db: image: postgres:16-alpine container_name: todo-db restart: unless-stopped environment: POSTGRES_USER: ${DB_USER:-todo} POSTGRES_PASSWORD: ${DB_PASSWORD:?DB_PASSWORD required} POSTGRES_DB: ${DB_NAME:-todo_app} volumes: - postgres_data:/var/lib/postgresql/data ports: - "5433:5432" # Using 5433 to avoid conflicts healthcheck: test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-todo}"] interval: 5s timeout: 5s retries: 5 # API Server api: build: context: ./apps/api dockerfile: Dockerfile container_name: todo-api restart: unless-stopped environment: DATABASE_URL: postgresql://${DB_USER:-todo}:${DB_PASSWORD}@db:5432/${DB_NAME:-todo_app} PORT: 3001 NODE_ENV: production APP_URL: ${APP_URL:-https://todo.donovankelly.xyz} ALLOWED_ORIGINS: ${ALLOWED_ORIGINS:-https://todo.donovankelly.xyz} RESEND_API_KEY: ${RESEND_API_KEY} FROM_EMAIL: ${FROM_EMAIL:-noreply@donovankelly.xyz} HAMMER_API_KEY: ${HAMMER_API_KEY} ports: - "3001:3001" depends_on: db: condition: service_healthy # Web Frontend (built and served by nginx) web: build: context: ./apps/web dockerfile: Dockerfile container_name: todo-web restart: unless-stopped ports: - "3002:80" depends_on: - api volumes: postgres_data: