Dockerfile 764 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. FROM python:3.10-slim
  2. # 设置工作目录
  3. WORKDIR /app
  4. # 安装系统依赖(Playwright 所需)
  5. RUN apt-get update && apt-get install -y \
  6. wget \
  7. gnupg \
  8. libnss3 \
  9. libnspr4 \
  10. libatk1.0-0 \
  11. libatk-bridge2.0-0 \
  12. libcups2 \
  13. libdrm2 \
  14. libdbus-1-3 \
  15. libxcb1 \
  16. libxdamage1 \
  17. libxext6 \
  18. libxfixes3 \
  19. libxrandr2 \
  20. libxcomposite1 \
  21. libx11-xcb1 \
  22. libxkbcommon0 \
  23. libxshmfence1 \
  24. && rm -rf /var/lib/apt/lists/*
  25. # 复制项目文件
  26. COPY requirements.txt .
  27. COPY *.py ./
  28. # 安装 Python 依赖
  29. RUN pip install --no-cache-dir -r requirements.txt
  30. # 安装 Playwright 浏览器
  31. RUN playwright install chromium
  32. # 设置环境变量
  33. ENV PYTHONUNBUFFERED=1
  34. # 启动应用
  35. CMD ["python", "run.py"]