From b371e484fb277372d9b766a06bd5ae1f456aa98d Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 21 Jul 2026 20:17:21 +0800 Subject: [PATCH] =?UTF-8?q?fix(worker):=20ffmpeg=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E8=84=9A=E6=9C=AC=E6=94=B9=E4=B8=BA=E7=BA=AFsh=E5=85=BC?= =?UTF-8?q?=E5=AE=B9=EF=BC=8C=E4=BF=AE=E5=A4=8Ddash=E6=95=B0=E7=BB=84?= =?UTF-8?q?=E8=AF=AD=E6=B3=95=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 问题:#686引入了bash数组语法 FFMPEG_SOURCES=(...),但worker基础镜像 的/bin/sh是dash,不支持数组,导致Worker Build报 Syntax error: "(" unexpected 修复: - 移除数组,改用 for src in "url1" "url2" "url3"; do 的纯sh写法 - 所有语法保持POSIX sh兼容,确保dash下能正常运行 - 保留所有原有功能:三源重试、tar校验、坏包清缓存、二进制校验 --- infra/docker/worker.Dockerfile | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/infra/docker/worker.Dockerfile b/infra/docker/worker.Dockerfile index d7549fb28..9b0c0ca5c 100755 --- a/infra/docker/worker.Dockerfile +++ b/infra/docker/worker.Dockerfile @@ -26,18 +26,17 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ && rm -rf /var/lib/apt/lists/* # ---- 下载静态编译 ffmpeg(带缓存+完整性校验+多源重试)---- -# 问题背景:johnvansickle.com 偶尔返回损坏文件,缓存命中坏包后反复失败 +# 注意:必须用纯sh语法(dash兼容),不能用bash数组、[[ ]]等特性 # 修复策略:1.三源下载 2.tar完整性校验 3.损坏删缓存重试 4.二进制可执行校验 RUN --mount=type=cache,target=/tmp/ffmpeg-cache,sharing=locked \ cd /tmp \ && FFMPEG_FILE="/tmp/ffmpeg-cache/ffmpeg-release-amd64-static.tar.xz" \ - && FFMPEG_SOURCES=( \ + && download_ok=0 \ + && for src in \ "https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz" \ "https://mirrors.tuna.tsinghua.edu.cn/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz" \ - "https://mirrors.ustc.edu.cn/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz" \ - ) \ - && download_ok=0 \ - && for src in "${FFMPEG_SOURCES[@]}"; do \ + "https://mirrors.ustc.edu.cn/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz"; \ + do \ if [ $download_ok -eq 0 ] && [ -f "$FFMPEG_FILE" ] && tar -tf "$FFMPEG_FILE" >/dev/null 2>&1; then \ echo "[ffmpeg] cache valid, skip download"; \ download_ok=1; \ -- 2.54.0