FROM python:3.12-slim ARG PORT=8051 WORKDIR /app # Install uv first (cached layer) RUN pip install uv # Copy only dependency files first (cached layer) COPY pyproject.toml uv.lock* ./ # Install dependencies (cached unless pyproject.toml changes) RUN uv pip install --system . # Run crawl4ai-setup for Playwright (cached layer) RUN crawl4ai-setup # Copy source code last (only this invalidates on code changes) COPY . . # Re-install in editable mode (fast, deps already installed) RUN uv pip install --system -e . --no-deps EXPOSE ${PORT} CMD ["python", "src/crawl4ai_mcp.py"]