chore: slim the worker image and streamline the Docker builds

This commit is contained in:
DiheChen committed 2026-11-06 00:47:47 +08:00
1 parent 22ddb5f49c
commit 48dcb1fd97
6 files changed
+102 -42

No files matched your search

+35
View File
@@ -0,0 +1,35 @@
#!/bin/sh
set -eu
case "$TARGETARCH" in
amd64) arch=x86_64 triple=x86_64-linux-gnu cross_gcc=gcc-x86-64-linux-gnu ;;
arm64) arch=aarch64 triple=aarch64-linux-gnu cross_gcc=gcc-aarch64-linux-gnu ;;
esac
dpkg --add-architecture "$TARGETARCH"
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install --yes --no-install-recommends \
ca-certificates gcc libc6-dev make nasm wget "$cross_gcc" \
"libc6-dev:$TARGETARCH" "libmp3lame-dev:$TARGETARCH" "zlib1g-dev:$TARGETARCH"
wget -q --tries=3 --timeout=30 -O /tmp/ffmpeg.tar.gz \
"https://github.com/FFmpeg/FFmpeg/archive/refs/tags/n$FFMPEG_VERSION.tar.gz"
mkdir /tmp/ffmpeg
tar -xzf /tmp/ffmpeg.tar.gz -C /tmp/ffmpeg --strip-components=1
cd /tmp/ffmpeg
audio_decoders=$(sed -n '/\/\* audio codecs \*\//,/\/\* subtitles \*\//s/.*ff_\([a-z0-9_]*\)_decoder;.*/\1/p' \
libavcodec/allcodecs.c | paste -sd,)
audio_decoders_listed_as_video=comfortnoise,dvaudio,eightsvx_exp,eightsvx_fib,rka,s302m,speex
./configure \
--enable-cross-compile --arch="$arch" --target-os=linux --cross-prefix="$triple-" \
--disable-everything --disable-autodetect --disable-doc --disable-debug --disable-network \
--disable-ffplay --disable-avdevice --disable-swscale \
--extra-ldexeflags=-static \
--enable-zlib --enable-libmp3lame --enable-encoder=libmp3lame \
--enable-protocol=file --enable-demuxers --enable-parsers --enable-bsfs \
--enable-muxers --enable-filter=aresample \
--enable-decoder="$audio_decoders,$audio_decoders_listed_as_video"
make -j"$(nproc)"
install -D -t /out/usr/local/bin ffmpeg ffprobe
+17
View File
@@ -0,0 +1,17 @@
#!/bin/sh
set -eu
case "$TARGETARCH" in
amd64) ytdlp=yt-dlp_linux deno=x86_64 ;;
arm64) ytdlp=yt-dlp_linux_aarch64 deno=aarch64 ;;
esac
wget -q --tries=3 --timeout=30 -O /tmp/yt-dlp.zip \
"https://github.com/yt-dlp/yt-dlp/releases/download/$YTDLP_VERSION/$ytdlp.zip"
wget -q --tries=3 --timeout=30 -O /tmp/deno.zip \
"https://github.com/denoland/deno/releases/download/$DENO_VERSION/deno-$deno-unknown-linux-gnu.zip"
mkdir -p /out/opt/yt-dlp /out/usr/local/bin
unzip -q /tmp/yt-dlp.zip -d /out/opt/yt-dlp
unzip -q /tmp/deno.zip -d /out/usr/local/bin
ln -s "/opt/yt-dlp/$ytdlp" /out/usr/local/bin/yt-dlp