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