基础设施: 统一依赖版本 + 新增 Docker 部署配置
- requirements.txt: GPU 依赖从注释改为正式声明,统一版本 PyTorch 2.1.2+cu121, TensorRT 8.6.1.6, ultralytics 8.3.5 NumPy 1.24→1.26.4, OpenCV 4.8.0.74→76, 新增 onnx/Pillow 等 - Dockerfile: 基于 nvcr.io/nvidia/tensorrt:23.08-py3 (CUDA 12.1 + cuDNN 8.9 + TRT 8.6) - docker-compose.yml: GPU 访问、host 网络、卷挂载、日志限制 - .dockerignore: 排除模型/数据/日志等大文件 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
46
docker-compose.yml
Normal file
46
docker-compose.yml
Normal file
@@ -0,0 +1,46 @@
|
||||
version: "3.8"
|
||||
|
||||
services:
|
||||
edge-inference:
|
||||
build: .
|
||||
image: edge-inference:latest
|
||||
container_name: edge-inference
|
||||
restart: always
|
||||
|
||||
# GPU 访问
|
||||
deploy:
|
||||
resources:
|
||||
reservations:
|
||||
devices:
|
||||
- driver: nvidia
|
||||
count: 1
|
||||
capabilities: [gpu]
|
||||
|
||||
# 环境变量
|
||||
env_file:
|
||||
- .env
|
||||
|
||||
# 卷挂载
|
||||
volumes:
|
||||
- ./models:/app/models # TensorRT 引擎文件
|
||||
- ./data:/app/data # SQLite + 截图缓存
|
||||
- ./logs:/app/logs # 运行日志
|
||||
- ./.env:/app/.env # 环境配置
|
||||
|
||||
# 网络(需要访问摄像头 RTSP + 云端 API + Redis)
|
||||
network_mode: host
|
||||
|
||||
# 健康检查
|
||||
healthcheck:
|
||||
test: ["CMD", "python", "-c", "import os; assert os.path.exists('/app/main.py')"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 30s
|
||||
|
||||
# 日志限制
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: "50m"
|
||||
max-file: "5"
|
||||
Reference in New Issue
Block a user