Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +10 -5
Dockerfile
CHANGED
|
@@ -2,17 +2,22 @@ FROM python:3.10-slim
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
-
#
|
| 6 |
RUN apt-get update && apt-get install -y git ffmpeg libsm6 libxext6 && rm -rf /var/lib/apt/lists/*
|
| 7 |
|
| 8 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
COPY requirements.txt .
|
| 10 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 11 |
|
| 12 |
COPY . .
|
| 13 |
|
| 14 |
-
# Expose the default Hugging Face port
|
| 15 |
EXPOSE 7860
|
| 16 |
-
|
| 17 |
-
# Run FastAPI using uvicorn
|
| 18 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
+
# System deps (PIL/ffmpeg helpful for images)
|
| 6 |
RUN apt-get update && apt-get install -y git ffmpeg libsm6 libxext6 && rm -rf /var/lib/apt/lists/*
|
| 7 |
|
| 8 |
+
# >>> Use /data for caches (writable volume on Spaces)
|
| 9 |
+
ENV XDG_CACHE_HOME=/data/.cache \
|
| 10 |
+
HF_HOME=/data/.cache/huggingface \
|
| 11 |
+
TRANSFORMERS_CACHE=/data/.cache/huggingface/hub \
|
| 12 |
+
HF_HUB_ENABLE_HF_TRANSFER=1
|
| 13 |
+
|
| 14 |
+
# Create cache dirs and make them writable
|
| 15 |
+
RUN mkdir -p /data/.cache/huggingface/hub && chmod -R 777 /data
|
| 16 |
+
|
| 17 |
COPY requirements.txt .
|
| 18 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 19 |
|
| 20 |
COPY . .
|
| 21 |
|
|
|
|
| 22 |
EXPOSE 7860
|
|
|
|
|
|
|
| 23 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|