Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +7 -5
Dockerfile
CHANGED
|
@@ -6,17 +6,19 @@ FROM python:3.9
|
|
| 6 |
# Set the working directory in the container
|
| 7 |
WORKDIR /app
|
| 8 |
|
| 9 |
-
#
|
| 10 |
ENV HF_HOME=/app/cache
|
| 11 |
ENV TRANSFORMERS_CACHE=/app/cache
|
| 12 |
-
# We set both, HF_HOME is the new standard, TRANSFORMERS_CACHE is for older versions.
|
| 13 |
|
| 14 |
-
# Copy
|
| 15 |
COPY requirements.txt .
|
| 16 |
-
|
| 17 |
-
# Install any needed packages specified in requirements.txt
|
| 18 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
# Copy the rest of your application code into the container
|
| 21 |
COPY . .
|
| 22 |
|
|
|
|
| 6 |
# Set the working directory in the container
|
| 7 |
WORKDIR /app
|
| 8 |
|
| 9 |
+
# Set a writable cache directory for Hugging Face models
|
| 10 |
ENV HF_HOME=/app/cache
|
| 11 |
ENV TRANSFORMERS_CACHE=/app/cache
|
|
|
|
| 12 |
|
| 13 |
+
# Copy and install requirements first to leverage Docker layer caching
|
| 14 |
COPY requirements.txt .
|
|
|
|
|
|
|
| 15 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 16 |
|
| 17 |
+
# --- FIX: Create the cache directory and set its permissions ---
|
| 18 |
+
# This ensures the directory exists and is writable by any user.
|
| 19 |
+
RUN mkdir -p /app/cache && \
|
| 20 |
+
chmod -R 777 /app/cache
|
| 21 |
+
|
| 22 |
# Copy the rest of your application code into the container
|
| 23 |
COPY . .
|
| 24 |
|