Files
deploy/media-deps/Dockerfile
T
2026-06-26 09:07:42 +08:00

40 lines
1.8 KiB
Docker
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 红动未来 - media 运行时基础镜像
# 包含 FFmpeg、Python3、PySceneDetect、Node.js、HyperFrames、Chromium
# 在 docker-compose-infra-main.yml 中构建,media/Dockerfile 继承此镜像
FROM alpine:3.21
# nodejs/npm 在 community 仓库
RUN sed -i 's|dl-cdn.alpinelinux.org|mirrors.aliyun.com|g' /etc/apk/repositories \
&& echo "https://mirrors.aliyun.com/alpine/v3.21/community" >> /etc/apk/repositories \
&& apk add --no-cache ca-certificates tzdata ffmpeg python3 py3-pip nodejs npm \
gcc musl-dev python3-dev linux-headers
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# opencv-python 无 Alpine musllinux 预编译 wheel,改用 apk 的 py3-opencv
RUN apk add --no-cache py3-opencv
# PySceneDetect--no-deps: scenedetect 强依赖 opencv-python 会触发源码编译)
# opencv 已由 apk 的 py3-opencv 提供
# pip 24+ 扫描系统包元数据时崩溃(python-4.10.0 版本号无效),用虚拟环境隔离
RUN python3 -m venv --system-site-packages /opt/venv \
&& /opt/venv/bin/pip install --no-deps -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com scenedetect \
&& /opt/venv/bin/pip install -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com click platformdirs tqdm
ENV PATH=/opt/venv/bin:$PATH
# 验证 PySceneDetect 安装
RUN python3 -c "import scenedetect; print(f'scenedetect {scenedetect.__version__} installed')"
# 预装 HyperFrames(全局安装)
RUN npm install -g hyperframes --ignore-scripts
# HyperFrames 渲染需要 Chromium/Chrome
# 安装 Chromium(提供系统级共享库依赖)和中文字体
RUN apk add --no-cache chromium font-noto-cjk fontconfig \
&& fc-cache -f
# 下载 HyperFrames 需要的 headless-shell 浏览器
RUN npx hyperframes browser ensure
WORKDIR /app