Spaces:
Running
Running
| # syntax=docker/dockerfile:1.7-labs | |
| FROM ghcr.io/astral-sh/uv:python3.12-bookworm | |
| # App directory | |
| WORKDIR /app | |
| # Ensure uv uses a project-local venv | |
| ENV UV_PROJECT_ENVIRONMENT=/app/.venv | |
| # Prefer CPU wheels for torch/torchvision and increase timeout for large wheels | |
| ENV UV_EXTRA_INDEX_URL=https://download.pytorch.org/whl/cpu | |
| ENV UV_HTTP_TIMEOUT=120 | |
| ENV UV_INDEX_STRATEGY=unsafe-best-match | |
| # Install dependencies with uv (uses cache for speed) | |
| COPY pyproject.toml uv.lock ./ | |
| RUN --mount=type=cache,target=/root/.cache/uv \ | |
| uv lock --upgrade --index-strategy unsafe-best-match && \ | |
| uv sync --no-dev --index-strategy unsafe-best-match | |
| # Copy the rest of the project | |
| COPY . . | |
| EXPOSE 7860 | |
| # Start the FastAPI app | |
| CMD ["uv", "run", "main.py"] | |