From 07302fda7fae3f0af4a323acb9397d078bf4f359 Mon Sep 17 00:00:00 2001 From: Jeason <1710884619@qq.com> Date: Wed, 18 Mar 2026 14:08:23 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20Dockerfile=E4=BD=BF=E7=94=A8=E5=9B=BD?= =?UTF-8?q?=E5=86=85=E9=95=9C=E5=83=8F=E5=8A=A0=E9=80=9F(pip+apt+playwrigh?= =?UTF-8?q?t)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index dbed51b..690940b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,10 @@ FROM python:3.11-slim WORKDIR /app +# 国内镜像加速 +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 + # 安装 Playwright 系统依赖 RUN apt-get update && \ apt-get install -y --no-install-recommends \ @@ -12,7 +16,13 @@ RUN apt-get update && \ rm -rf /var/lib/apt/lists/* COPY requirements.txt . -RUN pip install --no-cache-dir -r requirements.txt && \ + +# pip 阿里云镜像 + Playwright 国内 CDN 镜像 +ENV PLAYWRIGHT_DOWNLOAD_HOST=https://npmmirror.com/mirrors/playwright +RUN pip install --no-cache-dir \ + -i https://mirrors.aliyun.com/pypi/simple/ \ + --trusted-host mirrors.aliyun.com \ + -r requirements.txt && \ playwright install chromium COPY . . @@ -23,4 +33,6 @@ EXPOSE 9000 VOLUME ["/app/data"] +ENV FLASK_DEBUG=0 + CMD ["python", "run.py"]