version: '3.8' services: # HTML to PDF 服务 htmltopdf: build: context: . dockerfile: Dockerfile image: htmltopdf-service:2.0 container_name: htmltopdf-service ports: - "5000:5000" environment: - ASPNETCORE_ENVIRONMENT=Production - PdfService__TaskQueue__Redis__ConnectionString=redis:6379 - PdfService__Storage__LocalPath=/app/files - PdfService__BrowserPool__MaxInstances=10 - PdfService__BrowserPool__MinInstances=2 - PdfService__BrowserPool__MaxConcurrent=5 volumes: - htmltopdf-files:/app/files - htmltopdf-logs:/app/logs depends_on: redis: condition: service_healthy healthcheck: test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:5000/health"] interval: 30s timeout: 10s retries: 3 start_period: 60s restart: unless-stopped deploy: resources: limits: cpus: '4' memory: 4G reservations: cpus: '1' memory: 1G # Redis redis: image: redis:7-alpine container_name: htmltopdf-redis ports: - "6379:6379" volumes: - redis-data:/data healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 10s timeout: 5s retries: 5 restart: unless-stopped command: redis-server --appendonly yes volumes: htmltopdf-files: htmltopdf-logs: redis-data: networks: default: name: htmltopdf-network