version: '3.9' services: postgres: image: postgres:16-alpine container_name: website_monitor_db environment: POSTGRES_DB: website_monitor POSTGRES_USER: monitor_user POSTGRES_PASSWORD: ${DB_PASSWORD:-changeme} ports: - "5432:5432" volumes: - postgres_data:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U monitor_user"] interval: 10s timeout: 5s retries: 5 cpus: '1.0' redis: image: redis:7-alpine container_name: website_monitor_redis ports: - "6379:6379" healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 10s timeout: 5s retries: 5 cpus: '0.5' app: build: context: . dockerfile: Dockerfile target: runtime container_name: website_monitor_app ports: - "8080:8080" environment: - DATABASE_URL=postgresql://monitor_user:${DB_PASSWORD:-changeme}@postgres:5432/website_monitor - DB_HOST=postgres - DB_USER=monitor_user - DB_PASSWORD=${DB_PASSWORD:-changeme} - DB_NAME=website_monitor - REDIS_URL=redis://redis:6379 - SMTP_HOST=${SMTP_HOST:-smtp.gmail.com} - SMTP_PORT=${SMTP_PORT:-587} - SMTP_USER=${SMTP_USER} - SMTP_PASSWORD=${SMTP_PASSWORD} - ADMIN_EMAIL=${ADMIN_EMAIL:-admin@example.com} - SECRET_KEY=${SECRET_KEY:-change-this-secret-key-in-production} - ENVIRONMENT=production depends_on: postgres: condition: service_healthy redis: condition: service_healthy restart: unless-stopped cpus: '1.0' cpuset: '0' volumes: postgres_data: