Dockerfile 934 B

123456789101112131415161718192021222324252627282930313233
  1. FROM python:3.12-slim
  2. WORKDIR /app
  3. RUN apt-get update && apt-get install -y --no-install-recommends \
  4. build-essential \
  5. curl \
  6. libpq-dev \
  7. chromium \
  8. fonts-liberation fonts-ipafont-gothic fonts-wqy-zenhei fonts-freefont-ttf \
  9. libasound2 libx11-6 libnss3 libxcomposite1 libxrandr2 libxdamage1 \
  10. libxkbcommon0 libgtk-3-0 libdrm2 libgbm1 \
  11. && rm -rf /var/lib/apt/lists/*
  12. COPY pyproject.toml uv.lock ./
  13. # 配置 pip/uv 使用阿里云镜像,使用系统 Python
  14. ENV PIP_INDEX_URL=https://mirrors.aliyun.com/pypi/simple/
  15. ENV UV_INDEX_URL=https://mirrors.aliyun.com/pypi/simple/
  16. ENV UV_PYTHON_PREFERENCE=system
  17. RUN pip install --no-cache-dir uv && \
  18. uv sync --frozen --no-dev
  19. COPY . .
  20. # 安装 Playwright Chromium 浏览器(系统依赖已在上方 apt-get 中预装)
  21. RUN .venv/bin/python -m playwright install chromium
  22. RUN chmod +x entrypoint.sh
  23. ENTRYPOINT ["./entrypoint.sh"]
  24. EXPOSE 5000