Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +7 -6
Dockerfile
CHANGED
|
@@ -4,16 +4,17 @@ FROM python:3.10-slim
|
|
| 4 |
# Set the working directory in the container
|
| 5 |
WORKDIR /code
|
| 6 |
|
| 7 |
-
# --- FIX FOR PERMISSION ERROR ---
|
| 8 |
# Set environment variables to tell Hugging Face libraries where to cache models.
|
| 9 |
-
# This redirects the cache from the root directory (/.cache) to a local one (/code/cache).
|
| 10 |
ENV HF_HOME=/code/cache
|
| 11 |
ENV HF_HUB_CACHE=/code/cache
|
| 12 |
-
ENV TRANSFORMERS_CACHE=/code/cache
|
| 13 |
|
| 14 |
-
#
|
| 15 |
-
|
| 16 |
-
# -
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
# Copy the requirements file into the container at /code
|
| 19 |
COPY ./requirements.txt /code/requirements.txt
|
|
|
|
| 4 |
# Set the working directory in the container
|
| 5 |
WORKDIR /code
|
| 6 |
|
|
|
|
| 7 |
# Set environment variables to tell Hugging Face libraries where to cache models.
|
|
|
|
| 8 |
ENV HF_HOME=/code/cache
|
| 9 |
ENV HF_HUB_CACHE=/code/cache
|
| 10 |
+
ENV TRANSFORMERS_CACHE=/code/cache # Deprecated but harmless
|
| 11 |
|
| 12 |
+
# --- FIX FOR PERMISSION ERROR v2 ---
|
| 13 |
+
# Create the cache directory AND give it open write permissions for all users.
|
| 14 |
+
# This ensures that the non-root user running the CMD can write to it.
|
| 15 |
+
RUN mkdir -p /code/cache && \
|
| 16 |
+
chmod -R 777 /code/cache
|
| 17 |
+
# -----------------------------------
|
| 18 |
|
| 19 |
# Copy the requirements file into the container at /code
|
| 20 |
COPY ./requirements.txt /code/requirements.txt
|