File size: 740 Bytes
2893ee9 | 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 | FROM pytorch/pytorch:2.5.1-cuda12.1-cudnn9-runtime
# System deps
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential git curl ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# HF cache — writable directory inside container
ENV HF_HOME=/app/.cache/huggingface \
TRANSFORMERS_CACHE=/app/.cache/huggingface \
HF_HUB_ENABLE_HF_TRANSFER=1 \
PYTHONUNBUFFERED=1
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Pre-create HF cache dir (HF Spaces are read-only by default; this is writable)
RUN mkdir -p /app/.cache/huggingface && chmod -R 777 /app/.cache
COPY app.py .
EXPOSE 7860
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|