74fffbfccb
CI/CD Pipeline / Build Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been skipped
CI/CD Pipeline / ACR Image Cleanup (pull_request) Has been skipped
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 47s
CI/CD Pipeline / Frontend Lint (pull_request) Has been skipped
CI/CD Pipeline / Frontend Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / PR Build Web Image (pull_request) Has been skipped
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 1m25s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 36s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 39s
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 1m30s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 1m47s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 2m14s
AI Code Review / AI Code Review (pull_request) Successful in 2m44s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 3m29s
CI/CD Pipeline / Validate - Code Quality (pull_request) Successful in 5m11s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 2m4s
CI/CD Pipeline / Unit Tests (pull_request) Successful in 8m9s
CI/CD Pipeline / Build Production Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Deploy Production (pull_request) Has been skipped
CI/CD Pipeline / Canary Release to Production (pull_request) Has been skipped
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
CI/CD Pipeline / CI Gate (pull_request) Successful in 7s
ACR Cleanup / ACR Image Cleanup (pull_request_target) Successful in 39s
Preview Cleanup / Cleanup Preview Environment (pull_request) Successful in 1m7s
问题: fonts-noto-cjk apt 包安装的 .ttc 文件同时包含 Sans 和 Sans Mono 变体, 导致 fc-list 中 Bold 样式匹配到等宽字体(Noto Sans Mono CJK SC Bold), 视频标题加粗渲染时使用等宽字体,与前端预览的非等宽字体不一致。 修复: 1. 删除有问题的 NotoSansCJK-Regular.ttc 和 NotoSansCJK-Bold.ttc 2. 从 Google Fonts 下载单独的 Noto Sans SC Variable Font(不含 Mono) 3. 刷新字体缓存,确保 fontconfig 使用正确的字体 影响范围:api-base.Dockerfile 和 worker-base.Dockerfile 验收标准: - fc-list 中 Noto Sans CJK SC 的 Bold 变体不再是等宽字体 - 视频标题加粗渲染与前端预览一致
57 lines
2.3 KiB
Docker
57 lines
2.3 KiB
Docker
# ============================================================
|
||
# API 基础镜像(预构建)
|
||
# 预装系统依赖 + Python 依赖,业务构建从此镜像开始
|
||
# 当 requirements-base.txt 或 requirements.txt 变更时重新构建
|
||
# 目标:将 API Image 构建时间从 15-20 分钟降至 3-5 分钟
|
||
# ============================================================
|
||
|
||
FROM git.xiaoxiajianji.com/xiaoxia/base/python:3.12-slim
|
||
|
||
# 使用阿里云镜像加速
|
||
RUN sed -i 's|deb.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' /etc/apt/sources.list 2>/dev/null || true
|
||
|
||
# 预装系统依赖(gcc 编译 psycopg/pg 扩展,libpq-dev 编译期,libpq5 运行期,ffmpeg 封面取帧)
|
||
# 字体修复:fonts-noto-cjk 包的 .ttc 文件混入了 Mono 变体,导致 Bold 匹配到等宽字体
|
||
# 解决方案:删除有问题的 .ttc,从 Google Fonts 下载单独的 Noto Sans SC(不含 Mono)
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||
gcc \
|
||
libpq-dev \
|
||
libpq5 \
|
||
ffmpeg \
|
||
fonts-noto-cjk \
|
||
fontconfig \
|
||
curl \
|
||
&& rm -rf /var/lib/apt/lists/* \
|
||
# 删除有问题的 .ttc 文件(包含 Mono 变体)
|
||
&& rm -f /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc \
|
||
&& rm -f /usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc \
|
||
# 下载单独的 Noto Sans SC(Variable Font,包含所有字重,不含 Mono)
|
||
&& curl -fsSL -o /usr/share/fonts/opentype/noto/NotoSansSC-VF.ttf \
|
||
"https://github.com/google/fonts/raw/main/ofl/notosanssc/NotoSansSC%5Bwght%5D.ttf" \
|
||
# 刷新字体缓存
|
||
&& fc-cache -fv
|
||
|
||
# 创建虚拟环境
|
||
RUN python -m venv /opt/venv
|
||
ENV PATH="/opt/venv/bin:$PATH"
|
||
|
||
WORKDIR /tmp
|
||
|
||
# 预装 Python 基础依赖
|
||
COPY requirements-base.txt requirements.txt ./
|
||
RUN pip install --no-cache-dir \
|
||
-i https://mirrors.aliyun.com/pypi/simple/ \
|
||
--trusted-host mirrors.aliyun.com \
|
||
-r requirements-base.txt -r requirements.txt
|
||
|
||
# 虚拟环境瘦身
|
||
RUN find /opt/venv -name "*.so" -type f -exec strip --strip-all {} \; 2>/dev/null || true
|
||
RUN find /opt/venv -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null; \
|
||
find /opt/venv -name "*.pyc" -delete 2>/dev/null || true
|
||
|
||
# 清理临时文件
|
||
RUN rm -f /tmp/requirements-base.txt /tmp/requirements.txt
|
||
|
||
ENV PYTHONPATH=/app
|