Spaces:
Sleeping
Sleeping
File size: 754 Bytes
cfcf570 d6e7c16 cfcf570 c985f0d 4ee65ed 45ce52b 4ee65ed cfcf570 b93c015 cfcf570 45ce52b b93c015 cfcf570 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | # 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"]
|