docker-compose.yml 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. version: '3.8'
  2. services:
  3. jtjai_media:
  4. build:
  5. context: .
  6. dockerfile: Dockerfile
  7. platform: linux/amd64
  8. image: k8s.device.wenhq.top:8583/docker_r/jtjai_media:latest
  9. container_name: jtjai_media
  10. # 使用host网络模式以解决RTSP连接问题
  11. network_mode: host
  12. volumes:
  13. # 挂载配置文件(可选,如果需要修改配置)
  14. - ./config.json:/app/config.json:ro
  15. # 挂载输出目录到宿主机,持久化视频文件
  16. - ./output:/app/output
  17. restart: unless-stopped
  18. environment:
  19. - TZ=Asia/Shanghai
  20. # 添加网络调试环境变量
  21. - RTSP_DEBUG=1
  22. # 添加额外的网络配置
  23. extra_hosts:
  24. - "host.docker.internal:host-gateway"
  25. # DNS配置
  26. dns:
  27. - 8.8.8.8
  28. - 114.114.114.114
  29. # 资源限制(可选)
  30. deploy:
  31. resources:
  32. limits:
  33. cpus: '2.0'
  34. memory: 2G
  35. reservations:
  36. cpus: '1.0'
  37. memory: 512M
  38. # 健康检查
  39. healthcheck:
  40. test: ["CMD", "curl", "-f", "http://localhost:8080/"]
  41. interval: 30s
  42. timeout: 10s
  43. retries: 3
  44. start_period: 40s