fix(worker): ffmpeg下载脚本改为纯sh兼容,修复dash数组语法错误 #688

Merged
auto-approve-bot merged 1 commits from fix/worker-ffmpeg-sh-compat into develop 2026-07-21 20:20:56 +08:00
+5 -6
View File
@@ -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; \