docker-compose.yml 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. - USE_IP_DIRECT=1
  23. # 添加额外的网络配置
  24. extra_hosts:
  25. - "host.docker.internal:host-gateway"
  26. # 资源限制(可选)
  27. deploy:
  28. resources:
  29. limits:
  30. cpus: '2.0'
  31. memory: 2G
  32. reservations:
  33. cpus: '1.0'
  34. memory: 512M
  35. # 健康检查
  36. healthcheck:
  37. test: ["CMD", "curl", "-f", "http://localhost:8080/"]
  38. interval: 30s
  39. timeout: 10s
  40. retries: 3
  41. start_period: 40s