fix: add ffmpeg to API runtime image for cover fallback #1362

Merged
xiaoxia merged 1 commits from fix/api-ffmpeg-missing into develop 2026-08-13 21:40:23 +08:00
Owner

Problem

PR #1360 introduced FFmpeg-based frame extraction fallback for cover generation, but API Docker image does not include FFmpeg binary.

  • Worker image has FFmpeg via worker-base-runtime
  • API image runtime stage only has libpq5

Cover fallback path calls subprocess with ffmpeg, gets FileNotFoundError -> 500 error.

Fix

Add ffmpeg to apt-get install in runtime stage of infra/docker/api.Dockerfile.

## Problem PR #1360 introduced FFmpeg-based frame extraction fallback for cover generation, but API Docker image does not include FFmpeg binary. - Worker image has FFmpeg via worker-base-runtime - API image runtime stage only has libpq5 Cover fallback path calls subprocess with ffmpeg, gets FileNotFoundError -> 500 error. ## Fix Add ffmpeg to apt-get install in runtime stage of infra/docker/api.Dockerfile.
xiaoxia added 1 commit 2026-08-13 21:25:52 +08:00
fix: add ffmpeg to API runtime image for cover fallback
CI/CD Pipeline / Build Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / ACR Image Cleanup (pull_request) Has been skipped
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been skipped
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 38s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / Frontend Lint (pull_request) Has been skipped
CI/CD Pipeline / PR Build Web Image (pull_request) Has been skipped
AI Code Review / AI Code Review (pull_request) Successful in 1m13s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 1m31s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 1m40s
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 1m49s
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 2m7s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 3m24s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 3m24s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 3m23s
CI/CD Pipeline / Validate - Code Quality (pull_request) Successful in 7m19s
CI/CD Pipeline / Unit Tests (pull_request) Successful in 9m9s
CI/CD Pipeline / Build Production API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Deploy Production (pull_request) Has been skipped
CI/CD Pipeline / Canary Release to Production (pull_request) Has been skipped
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
CI/CD Pipeline / Integration Tests (pull_request) Successful in 4m59s
CI/CD Pipeline / CI Gate (pull_request) Successful in 6s
ACR Cleanup / ACR Image Cleanup (pull_request_target) Successful in 53s
Preview Cleanup / Cleanup Preview Environment (pull_request) Successful in 1m14s
7eab4bc508
PR #1360 introduced FFmpeg-based frame extraction as fallback for cover
generation, but the API Docker image did not include FFmpeg binary.
Worker image already has it via worker-base-runtime, but API image only
had libpq5 in its runtime stage.

This caused subprocess calls to fail with FileNotFoundError when the
cover generation tried to use _extract_frames_with_ffmpeg fallback.

Fix: add ffmpeg to apt-get install in runtime stage of api.Dockerfile.
Collaborator

【阻塞级判定】

  • 是否存在阻塞级问题:否
  • 阻塞级问题数量:0 个

📊 审查概览

  • 整体评价:通过
  • 建议级问题数量:0 个

🔴 阻塞级问题(必须修复)

💡 改进建议(不阻塞合并)

良好实践

  1. [infra/docker/api.Dockerfile] 依赖管理规范
    • 使用了 --no-install-recommends 参数,避免引入不必要的非直接依赖,有助于减小最终镜像体积。
  2. [infra/docker/api.Dockerfile] 镜像优化
    • 在安装完依赖后立即执行 rm -rf /var/lib/apt/lists/*,有效清理了 apt 缓存文件,这是减小 Docker 镜像大小的标准最佳实践。
  3. [infra/docker/api.Dockerfile] 注释维护
    • 及时更新了注释,准确说明了新增 ffmpeg 包的业务用途(封面兜底取帧),便于后续维护。

🤖 由 AI 代码审查机器人自动生成 | 2026-08-13 13:27:06 | 模型:

### 【阻塞级判定】 - 是否存在阻塞级问题:否 - 阻塞级问题数量:0 个 ### 📊 审查概览 - 整体评价:通过 - 建议级问题数量:0 个 ### 🔴 阻塞级问题(必须修复) 无 ### 💡 改进建议(不阻塞合并) 无 ### ✅ 良好实践 1. **[infra/docker/api.Dockerfile] 依赖管理规范** - 使用了 `--no-install-recommends` 参数,避免引入不必要的非直接依赖,有助于减小最终镜像体积。 2. **[infra/docker/api.Dockerfile] 镜像优化** - 在安装完依赖后立即执行 `rm -rf /var/lib/apt/lists/*`,有效清理了 apt 缓存文件,这是减小 Docker 镜像大小的标准最佳实践。 3. **[infra/docker/api.Dockerfile] 注释维护** - 及时更新了注释,准确说明了新增 `ffmpeg` 包的业务用途(封面兜底取帧),便于后续维护。 --- <sub>🤖 由 AI 代码审查机器人自动生成 | 2026-08-13 13:27:06 | 模型: </sub> <!-- AI_CODE_REVIEW_AUTO_COMMENT -->

🚀 预览环境已部署

项目 详情
PR号 #1362
预览链接 https://pr-1362.preview.xiaoxiajianji.com
API环境 staging

💡 预览环境使用 staging API 数据,请勿在预览环境中操作重要数据。

🔄 每次提交新代码后预览环境会自动更新。

🗑️ PR 关闭或合并后,预览环境会自动清理。

🚀 **预览环境已部署** | 项目 | 详情 | |------|------| | PR号 | #1362 | | 预览链接 | [https://pr-1362.preview.xiaoxiajianji.com](https://pr-1362.preview.xiaoxiajianji.com) | | API环境 | staging | > 💡 预览环境使用 staging API 数据,请勿在预览环境中操作重要数据。 > > 🔄 每次提交新代码后预览环境会自动更新。 > > 🗑️ PR 关闭或合并后,预览环境会自动清理。
auto-approve-bot approved these changes 2026-08-13 21:35:30 +08:00
auto-approve-bot left a comment
Collaborator

CI全绿,自动审批通过。

CI全绿,自动审批通过。
auto-approve-bot approved these changes 2026-08-13 21:35:30 +08:00
auto-approve-bot left a comment
Collaborator

CI全绿,自动审批通过。

CI全绿,自动审批通过。
xiaoxia merged commit 0896f3e161 into develop 2026-08-13 21:40:23 +08:00

🗑️ 预览环境已清理

PR #1362 已关闭或合并,对应的预览环境已被清理。

如有需要,可以重新打开 PR 来重新生成预览环境。

🗑️ **预览环境已清理** PR #1362 已关闭或合并,对应的预览环境已被清理。 > 如有需要,可以重新打开 PR 来重新生成预览环境。
Sign in to join this conversation.