version: '3.8' services: sms-forwarder: build: . container_name: sms-forwarder ports: - "12152:12152" volumes: - ./config.yaml:/app/config.yaml:ro - sms_logs:/app/logs - sms_data:/app/data environment: - CONFIG_PATH=/app/config.yaml restart: unless-stopped healthcheck: test: ["CMD", "curl", "-f", "http://localhost:12152/health"] interval: 30s timeout: 10s retries: 3 start_period: 40s deploy: resources: limits: memory: 256M cpus: '0.5' reservations: memory: 128M cpus: '0.1' logging: driver: "json-file" options: max-size: "10m" max-file: "3" # Nginx 反向代理(可选,用于 HTTPS) nginx: image: nginx:alpine container_name: sms-forwarder-nginx ports: - "80:80" - "443:443" volumes: - ./nginx.conf:/etc/nginx/nginx.conf:ro - ./ssl:/etc/nginx/ssl:ro depends_on: - sms-forwarder restart: unless-stopped profiles: - nginx volumes: sms_logs: sms_data: