# ============================================================ # 鸣鹤 (MingHe) SIP Server — Docker Compose 配置 # ============================================================ # # 使用方法: # 1. 复制配置模板: cp config.template.toml config/config.toml # 2. 编辑配置文件: vim config/config.toml # 3. 构建本地镜像: docker build -t facilisvelox/minghe:latest . # 4. 启动服务: docker compose up -d --force-recreate # 5. 查看日志: docker compose logs -f # 6. 停止服务: docker compose down # # ============================================================ services: minghe: image: facilisvelox/minghe:latest # 容器名称 container_name: minghe-sip # 自动重启策略 restart: unless-stopped security_opt: - no-new-privileges:true cap_drop: - ALL read_only: true # 端口映射 ports: # SIP TLS 信令端口 - "${SIP_PORT:-5061}:5061/tcp" # SDES/ZRTP 中继(含奇数 RTCP 端口);.env 仅设置映射,TOML 端口范围须同步 - "${RTP_PORT_START:-20000}-${RTP_PORT_END:-20020}:${RTP_PORT_START:-20000}-${RTP_PORT_END:-20020}/udp" # 卷挂载 volumes: # 配置文件 - ./config:/app/config:ro # TLS 证书持久化(使用 Docker 命名卷,避免宿主机目录权限导致证书无法写入) - certs:/app/certs # 环境变量 environment: # 日志级别: error, warn, info, debug, trace - RUST_LOG=${RUST_LOG:-info} # 时区 - TZ=${TZ:-Asia/Shanghai} # 资源限制 deploy: resources: limits: # CPU 限制。默认 1.0,兼容 1 核 VPS;多核机器可通过 CPU_LIMIT 调高。 cpus: "${CPU_LIMIT:-1.0}" # 内存限制 memory: "${MEM_LIMIT:-512M}" reservations: cpus: "0.25" memory: 64M # 健康检查 healthcheck: test: ["CMD", "pgrep", "minghe"] interval: 30s timeout: 5s retries: 3 start_period: 10s # 日志配置 logging: driver: json-file options: max-size: "10m" max-file: "3" volumes: certs: