refactor: API/Worker 依赖拆分 - 移除 API 镜像中的重依赖
Deploy / Build Production Runtime Images (push) Has been skipped
Deploy / Deploy Production (push) Has been skipped
Deploy / Production Browser E2E (push) Has been skipped
Deploy / Staging E2E Tests (push) Failing after 93h39m59s
Deploy / Deploy Staging (push) Failing after 94h0m21s
CI/CD Pipeline / Frontend Lint (push) Failing after 94h0m28s
CI/CD Pipeline / Validate Code Quality And Tests (push) Failing after 94h0m28s

- 新建 requirements-worker.txt,包含 numpy/scipy/opencv/Pillow/ffmpeg-python
- requirements-base.txt 移除视频处理大包,仅保留公共基础依赖
- worker.Dockerfile 新增 requirements-worker.txt 安装层
- API Dockerfile 无需修改,自动不再包含重包
- 验证:API/packages 代码无 numpy/scipy/cv2 导入
- 全量测试 994 passed, 0 failed

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
灵应
2026-07-05 14:54:04 +08:00
parent c9c7c36b1d
commit bf6ae9c430
3 changed files with 23 additions and 7 deletions
+6
View File
@@ -28,6 +28,12 @@ RUN python -m venv /opt/venv \
&& /opt/venv/bin/pip install --no-cache-dir -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com -r /tmp/requirements-base.txt \
&& rm /tmp/requirements-base.txt
# ---- 依赖分层:Worker 专属大包(视频处理,变化极少)----
COPY requirements-worker.txt /tmp/requirements-worker.txt
RUN /opt/venv/bin/pip install --no-cache-dir -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com -r /tmp/requirements-worker.txt \
&& rm /tmp/requirements-worker.txt
# ---- 依赖分层:业务依赖(变化频繁)----
COPY requirements.txt /tmp/requirements.txt
-7
View File
@@ -22,13 +22,6 @@ redis==5.2.0
# 任务队列
celery==5.4.0
# 视频处理(大包,变化极少)
numpy>=1.24.0
scipy>=1.10.0
opencv-python-headless>=4.8.0
Pillow==10.4.0
ffmpeg-python==0.2.0
# 对象存储
oss2==2.18.4
+17
View File
@@ -0,0 +1,17 @@
# 小虾 SaaS - Worker 专属依赖(视频处理大包,仅 Worker 需要)
# 这些包体积大,API 服务不需要安装
# 数值计算
numpy>=1.24.0
# 科学计算
scipy>=1.10.0
# 计算机视觉(视频去重、帧处理)
opencv-python-headless>=4.8.0
# 图像处理
Pillow==10.4.0
# FFmpeg Python 绑定
ffmpeg-python==0.2.0