From adcfc1e9196e267ba1a9bd068fbee54c77c7c8ff Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Mon, 31 Aug 2026 23:54:22 +0800 Subject: [PATCH] =?UTF-8?q?perf(ci):=20ci-base=20=E9=95=9C=E5=83=8F?= =?UTF-8?q?=E9=A2=84=E8=A3=85=20ffmpeg=E2=80=94=E2=80=94=E6=B6=88=E9=99=A4?= =?UTF-8?q?=20unit-tests=20=E6=AF=8F=E6=AC=A1=2024min=20apt=20=E5=AE=89?= =?UTF-8?q?=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit unit-tests job 跑在全新容器里,ci-base 镜像未预装 ffmpeg, step_install_ffmpeg.sh 每次都 apt-get update + install ffmpeg, ffmpeg 拉取 x264/aom/systemd 等数百个编解码依赖,固定耗时约 24 分钟, pytest 本身 21-23 分钟,导致该 job 每次 45-50 分钟。 把 ffmpeg 预装到 ci-base 镜像后,step_install_ffmpeg.sh 检测到 ffmpeg 已存在会立即退出(exit 0),unit-tests 直接省掉 ~24 分钟。 注:ci-base 镜像需重建并推送 registry 后生效。 --- infra/docker/ci.Dockerfile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/infra/docker/ci.Dockerfile b/infra/docker/ci.Dockerfile index a9422ee40..8849bf135 100644 --- a/infra/docker/ci.Dockerfile +++ b/infra/docker/ci.Dockerfile @@ -30,6 +30,14 @@ RUN apt-get update \ && apt-get install -y --no-install-recommends docker-ce-cli docker-buildx-plugin \ && rm -rf /var/lib/apt/lists/* +# Pre-bake ffmpeg: unit-tests run in fresh containers each time; installing ffmpeg +# on every job cost ~24 min (apt update + hundreds of codec deps). Bake it into the +# image so step_install_ffmpeg.sh detects it and exits instantly. +RUN apt-get update \ + && apt-get install -y --no-install-recommends ffmpeg \ + && ffmpeg -version | head -1 \ + && rm -rf /var/lib/apt/lists/* + # Pre-install base deps (layer cache) COPY requirements-base.txt ./ RUN python -m venv "$VIRTUAL_ENV" \ -- 2.54.0