This commit is contained in:
mzl
2026-01-12 12:48:54 +08:00
parent 75c56f34e2
commit 14f4d359b5
+8 -3
View File
@@ -1,11 +1,13 @@
FROM python:3.10-slim FROM python:3.10-slim
# 安装系统依赖(包含 Git) # 安装系统依赖(包含 Git 和 Playwright 所需的所有库)
# 注意:这里手动安装所有 Chromium 运行所需的依赖,跳过 playwright install-deps
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
wget \ wget \
gnupg \ gnupg \
ca-certificates \ ca-certificates \
fonts-liberation \ fonts-liberation \
fonts-unifont \
libasound2 \ libasound2 \
libatk-bridge2.0-0 \ libatk-bridge2.0-0 \
libatk1.0-0 \ libatk1.0-0 \
@@ -25,6 +27,9 @@ RUN apt-get update && apt-get install -y \
libxrandr2 \ libxrandr2 \
xdg-utils \ xdg-utils \
git \ git \
libu2f-udev \
libvulkan1 \
libxss1 \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
WORKDIR /app WORKDIR /app
@@ -35,9 +40,9 @@ COPY requirements.txt .
# 安装 Python 依赖 # 安装 Python 依赖
RUN pip install --no-cache-dir -r requirements.txt RUN pip install --no-cache-dir -r requirements.txt
# 安装 Playwright 浏览器 # 只安装 Playwright 浏览器二进制文件,跳过系统依赖安装
# PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=0 确保下载浏览器
RUN playwright install chromium RUN playwright install chromium
RUN playwright install-deps chromium
# 复制应用代码 # 复制应用代码
COPY . . COPY . .