Dockerfile 738 B

123456789101112131415161718192021222324252627282930
  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. && rm -rf /var/lib/apt/lists/*
  9. COPY pyproject.toml uv.lock ./
  10. # 配置 pip/uv 使用阿里云镜像,使用系统 Python
  11. ENV PIP_INDEX_URL=https://mirrors.aliyun.com/pypi/simple/
  12. ENV UV_INDEX_URL=https://mirrors.aliyun.com/pypi/simple/
  13. ENV UV_PYTHON_PREFERENCE=system
  14. RUN pip install --no-cache-dir uv && \
  15. uv sync --frozen --no-dev
  16. COPY . .
  17. # 安装 Playwright 系统依赖(不下载 Chromium,使用系统 chromium 包)
  18. RUN .venv/bin/python -m playwright install-deps chromium
  19. RUN chmod +x entrypoint.sh
  20. ENTRYPOINT ["./entrypoint.sh"]
  21. EXPOSE 5000