Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +12 -6
Dockerfile
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
# 1. Use an official Python runtime
|
| 2 |
FROM python:3.12-slim
|
| 3 |
|
| 4 |
# 2. Set working directory
|
|
@@ -14,17 +13,24 @@ RUN apt-get update && apt-get install -y \
|
|
| 14 |
libglib2.0-0 \
|
| 15 |
&& rm -rf /var/lib/apt/lists/*
|
| 16 |
|
| 17 |
-
# 4.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
COPY requirements.txt .
|
| 19 |
|
| 20 |
-
#
|
| 21 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 22 |
|
| 23 |
-
#
|
| 24 |
COPY . .
|
| 25 |
|
| 26 |
-
#
|
| 27 |
EXPOSE 7860
|
| 28 |
|
| 29 |
-
#
|
| 30 |
CMD ["python", "app.py"]
|
|
|
|
|
|
|
|
|
| 1 |
FROM python:3.12-slim
|
| 2 |
|
| 3 |
# 2. Set working directory
|
|
|
|
| 13 |
libglib2.0-0 \
|
| 14 |
&& rm -rf /var/lib/apt/lists/*
|
| 15 |
|
| 16 |
+
# 4. Set Hugging Face cache directories (important fix!)
|
| 17 |
+
ENV HF_HOME=/app/.cache/huggingface
|
| 18 |
+
ENV TRANSFORMERS_CACHE=/app/.cache/huggingface/transformers
|
| 19 |
+
|
| 20 |
+
RUN mkdir -p /app/.cache/huggingface
|
| 21 |
+
|
| 22 |
+
# 5. Copy requirements
|
| 23 |
COPY requirements.txt .
|
| 24 |
|
| 25 |
+
# 6. Install dependencies
|
| 26 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 27 |
|
| 28 |
+
# 7. Copy the app code
|
| 29 |
COPY . .
|
| 30 |
|
| 31 |
+
# 8. Expose Gradio default port
|
| 32 |
EXPOSE 7860
|
| 33 |
|
| 34 |
+
# 9. Run the Gradio app
|
| 35 |
CMD ["python", "app.py"]
|
| 36 |
+
|