version: '3.8' services: # API Service - Production Configuration api: build: context: . dockerfile: Dockerfile container_name: ulflow-api restart: always ports: - "8080:8080" env_file: - .env environment: - APP_ENV=production depends_on: - postgres networks: - ulflow-network deploy: resources: limits: cpus: '1' memory: 1G restart_policy: condition: on-failure max_attempts: 3 healthcheck: test: ["CMD", "wget", "--spider", "-q", "http://localhost:8080/health"] interval: 30s timeout: 10s retries: 3 start_period: 40s # PostgreSQL Database - Production Configuration postgres: image: postgres:15-alpine container_name: ulflow-postgres restart: always environment: POSTGRES_USER: ${DB_USER:-user} POSTGRES_PASSWORD: ${DB_PASSWORD:-password} POSTGRES_DB: ${DB_NAME:-ulflow_db} volumes: - postgres-data:/var/lib/postgresql/data networks: - ulflow-network deploy: resources: limits: cpus: '1' memory: 1G healthcheck: test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-user} -d ${DB_NAME:-ulflow_db}"] interval: 30s timeout: 5s retries: 3 start_period: 10s # Nginx Reverse Proxy nginx: image: nginx:alpine container_name: ulflow-nginx restart: always ports: - "80:80" - "443:443" volumes: - ./nginx/conf.d:/etc/nginx/conf.d - ./nginx/ssl:/etc/nginx/ssl - ./nginx/logs:/var/log/nginx depends_on: - api networks: - ulflow-network volumes: postgres-data: networks: ulflow-network: driver: bridge