chore(docker): 优化Dockerfile_base镜像构建配置

- 更换阿里云镜像源提升apt-get安装速度
- 新增openssh-client和autossh系统依赖
- 所有apt-get操作后统一清理缓存
- Playwright依赖安装使用阿里云源镜像
- 安装中文字体时允许失败不影响构建
- 保持时区配置为Asia/Shanghai
- 安装Playwright chromium浏览器版本一致
This commit is contained in:
2026-03-26 21:21:59 +08:00
parent 49acca7414
commit 091ee05e58

View File

@@ -3,13 +3,16 @@ FROM python:3.12-slim
# 设置工作目录
WORKDIR /app
# 安装系统依赖
RUN apt-get update && apt-get install -y \
# 更换阿里云镜像源并安装系统依赖
RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list.d/debian.sources && \
apt-get update && apt-get install -y \
wget \
gnupg \
openssh-client \
autossh \
&& rm -rf /var/lib/apt/lists/*
# 安装Playwright的依赖
# 安装Playwright的依赖(使用阿里云源)
RUN apt-get update && apt-get install -y \
libnss3 \
libnspr4 \
@@ -64,12 +67,12 @@ RUN apt-get update && apt-get install -y \
libopengl0 \
&& rm -rf /var/lib/apt/lists/*
# 安装中文字体
# 安装中文字体(使用阿里云源,允许失败)
RUN apt-get update && apt-get install -y \
fonts-noto-cjk \
fonts-wqy-zenhei \
fonts-wqy-microhei \
&& rm -rf /var/lib/apt/lists/*
&& rm -rf /var/lib/apt/lists/* || echo "字体安装失败,继续构建"
# 安装Playwright浏览器
RUN playwright install chromium