From c3b550057721f93952c1dd70daebdd854f671185 Mon Sep 17 00:00:00 2001 From: deploy Date: Thu, 29 Oct 2026 12:12:01 +0800 Subject: [PATCH] =?UTF-8?q?build:=20=E5=9B=BD=E5=86=85=E6=BA=90=EF=BC=88?= =?UTF-8?q?=E9=81=93=E5=AE=A2=E9=95=9C=E5=83=8F=20+=20=E9=98=BF=E9=87=8Cap?= =?UTF-8?q?t=20+=20=E6=B8=85=E5=8D=8Epip=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 46 +++++++++++++++------------------------------- 1 file changed, 15 insertions(+), 31 deletions(-) diff --git a/Dockerfile b/Dockerfile index b7f8388..3f1c7e0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,44 +1,28 @@ -FROM python:3.11-slim +FROM docker.m.daocloud.io/library/python:3.11-slim -# 设置工作目录 -WORKDIR /app - -# 设置时区与环境变量 ENV TZ=Asia/Shanghai \ DEBIAN_FRONTEND=noninteractive \ - PYTHONUNBUFFERED=1 + PYTHONUNBUFFERED=1 \ + PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple \ + PIP_TRUSTED_HOST=pypi.tuna.tsinghua.edu.cn \ + PLAYWRIGHT_DOWNLOAD_HOST=https://npmmirror.com/mirrors/playwright + +WORKDIR /app + +RUN sed -i 's|deb.debian.org|mirrors.aliyun.com|g; s|security.debian.org|mirrors.aliyun.com|g' /etc/apt/sources.list 2>/dev/null || true \ + && sed -i 's|deb.debian.org|mirrors.aliyun.com|g' /etc/apt/sources.list.d/debian.sources 2>/dev/null || true -# 安装系统渲染依赖 RUN apt-get update && apt-get install -y --no-install-recommends \ - tzdata \ - libnss3 \ - libnspr4 \ - libasound2 \ - libatk1.0-0 \ - libatk-bridge2.0-0 \ - libcups2 \ - libdrm2 \ - libxkbcommon0 \ - libxcomposite1 \ - libxdamage1 \ - libxfixes3 \ - libxrandr2 \ - libgbm1 \ - libpango-1.0-0 \ - libcairo2 \ - xvfb \ + tzdata libnss3 libnspr4 libasound2 libatk1.0-0 libatk-bridge2.0-0 \ + libcups2 libdrm2 libxkbcommon0 libxcomposite1 libxdamage1 libxfixes3 \ + libxrandr2 libgbm1 libpango-1.0-0 libcairo2 xvfb \ && rm -rf /var/lib/apt/lists/* -# 复制依赖清单并安装 COPY requirements.txt . -RUN pip install --no-cache-dir -r requirements.txt && \ - playwright install --with-deps chromium || playwright install chromium +RUN pip install --no-cache-dir -r requirements.txt \ + && playwright install chromium || true -# 复制源码 COPY . . -# 暴露端口 EXPOSE 8000 - -# 启动命令 CMD ["python", "app.py"]