diff --git a/Dockerfile b/Dockerfile index 5844ab0..d9f06cf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,13 @@ FROM python:3.10-slim -# 安装系统依赖(包含 Git) +# 安装系统依赖(包含 Git 和 Playwright 所需的所有库) +# 注意:这里手动安装所有 Chromium 运行所需的依赖,跳过 playwright install-deps RUN apt-get update && apt-get install -y \ wget \ gnupg \ ca-certificates \ fonts-liberation \ + fonts-unifont \ libasound2 \ libatk-bridge2.0-0 \ libatk1.0-0 \ @@ -25,6 +27,9 @@ RUN apt-get update && apt-get install -y \ libxrandr2 \ xdg-utils \ git \ + libu2f-udev \ + libvulkan1 \ + libxss1 \ && rm -rf /var/lib/apt/lists/* WORKDIR /app @@ -35,9 +40,9 @@ COPY requirements.txt . # 安装 Python 依赖 RUN pip install --no-cache-dir -r requirements.txt -# 安装 Playwright 浏览器 +# 只安装 Playwright 浏览器二进制文件,跳过系统依赖安装 +# PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=0 确保下载浏览器 RUN playwright install chromium -RUN playwright install-deps chromium # 复制应用代码 COPY . .