version: '3.8' services: web: build: . command: gunicorn --bind 0.0.0.0:5000 app:app ports: - "${PORT:-10335}:5000" environment: - FLASK_APP=app.py - FLASK_ENV=production - DATABASE_URL=postgresql://postgres:postgres@db:5432/docupulse - POSTGRES_USER=postgres - POSTGRES_PASSWORD=postgres - POSTGRES_DB=docupulse - MASTER=false volumes: - docupulse_uploads:/app/uploads depends_on: - db restart: unless-stopped healthcheck: test: ["CMD", "curl", "-f", "http://localhost:5000/health"] interval: 30s timeout: 10s retries: 5 start_period: 40s deploy: resources: limits: cpus: '1' memory: 1G networks: - public_network - internal_network db: image: postgres:13 environment: - POSTGRES_USER=postgres - POSTGRES_PASSWORD=postgres - POSTGRES_DB=docupulse volumes: - docupulse_postgres_data:/var/lib/postgresql/data restart: unless-stopped healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres"] interval: 30s timeout: 10s retries: 3 networks: - internal_network volumes: docupulse_postgres_data: name: docupulse_${COMPOSE_PROJECT_NAME:-default}_postgres_data driver: local docupulse_uploads: name: docupulse_${COMPOSE_PROJECT_NAME:-default}_uploads driver: local networks: public_network: name: docupulse_public internal_network: name: docupulse_internal internal: true # This network is not accessible from outside Docker ipam: config: - subnet: 10.42.0.0/16 # Less commonly used subnet