- Dockerfile: 补装 ffmpeg 与中文字体 fonts-noto-cjk,修线上导出报 "No such file or directory: 'ffmpeg'" 及字幕中文方块;换阿里云 apt 源防构建超时 - export.py: 字幕字体加载加 Noto CJK glob 兜底,适配不同版本 fonts-noto-cjk - pipeline.tsx: 配音预览改 Web Audio 精确排程(借鉴 WebAV)——预解码 + source.start(when,offset) + 增量重排,正在发声的句绝不掐断,消除字幕音错位与卡顿 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
36 lines
1.6 KiB
Docker
36 lines
1.6 KiB
Docker
# ---- AirShelf core backend: Django + DRF + gunicorn / celery ----
|
|
FROM docker.m.daocloud.io/python:3.12-slim
|
|
|
|
ENV PYTHONUNBUFFERED=1 \
|
|
PYTHONDONTWRITEBYTECODE=1 \
|
|
PIP_NO_CACHE_DIR=1 \
|
|
PIP_INDEX_URL=https://mirrors.aliyun.com/pypi/simple/
|
|
|
|
WORKDIR /app
|
|
|
|
# 视频导出(stage5 拼接)靠 ffmpeg 二进制;字幕用 Pillow 渲染 PNG 需中文字体(fonts-noto-cjk),
|
|
# 否则线上导出报 "No such file or directory: 'ffmpeg'" / 中文字幕变方块。slim 镜像默认两者都无。
|
|
# 换阿里云 apt 源避免国内构建超时(兼容 bookworm 的 deb822 与旧 sources.list 两种格式)。
|
|
RUN (sed -i 's|deb.debian.org|mirrors.aliyun.com|g; s|security.debian.org|mirrors.aliyun.com|g' /etc/apt/sources.list.d/debian.sources 2>/dev/null \
|
|
|| sed -i 's|deb.debian.org|mirrors.aliyun.com|g; s|security.debian.org|mirrors.aliyun.com|g' /etc/apt/sources.list 2>/dev/null || true) \
|
|
&& apt-get update \
|
|
&& apt-get install -y --no-install-recommends ffmpeg fonts-noto-cjk \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# PyMySQL is pure-python (install_as_MySQLdb), boto3/gunicorn need no C deps,
|
|
# so the slim image is enough — no build-essential required.
|
|
COPY requirements.txt .
|
|
RUN pip install --upgrade pip && pip install -r requirements.txt
|
|
|
|
COPY . .
|
|
|
|
# Collected admin/static lands here; served by WhiteNoise (see settings/production.py)
|
|
RUN mkdir -p /app/staticfiles
|
|
|
|
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
|
|
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
|
|
|
EXPOSE 8000
|
|
ENTRYPOINT ["docker-entrypoint.sh"]
|
|
CMD ["gunicorn", "airshelf.wsgi:application", "--bind", "0.0.0.0:8000", "--workers", "3", "--timeout", "120"]
|