FROM python:3.10-slim # System deps for opencv-headless and torch RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ libgl1 \ libglib2.0-0 \ git \ && rm -rf /var/lib/apt/lists/* WORKDIR /app # Tell torch.hub where to cache DINOv2 so it persists across rebuilds ENV TORCH_HOME=/app/.torch_cache ENV HF_HOME=/app/.hf_cache COPY requirements.txt . RUN pip install --no-cache-dir --upgrade pip && \ pip install --no-cache-dir -r requirements.txt COPY . . EXPOSE 7860 CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "7860"]