build: 切换国内 Rust/APT 镜像至中科大并支持自定义下载代理

This commit is contained in:
mofeng-git
2026-09-22 09:30:07 +08:00
parent d71112380c
commit e85f0a9bfe
7 changed files with 65 additions and 36 deletions

View File

@@ -8,11 +8,16 @@ ARG TARGETPLATFORM=linux/amd64
FROM debian:12-slim
ARG TARGETPLATFORM
ARG APT_MIRROR=
# Install runtime dependencies in a single layer
# All codec libraries (libx264, libx265, libopus) are now statically linked
# Only hardware acceleration drivers and core system libraries remain dynamic
RUN sed -i 's/^Components: main$/Components: main contrib non-free non-free-firmware/' /etc/apt/sources.list.d/debian.sources && \
# Set APT_MIRROR=mirrors.tuna.tsinghua.edu.cn to speed up builds in China
RUN if [ -n "$APT_MIRROR" ]; then \
sed -i "s@deb.debian.org@${APT_MIRROR}@g" /etc/apt/sources.list.d/debian.sources; \
fi \
&& sed -i 's/^Components: main$/Components: main contrib non-free non-free-firmware/' /etc/apt/sources.list.d/debian.sources && \
apt-get update && \
apt-get install -y --no-install-recommends \
# Core runtime (all platforms) - no codec libs needed