Fix permissions in Dockerfile
Browse filesAdded environment variables and created writable directories for caches
- Dockerfile +13 -5
Dockerfile
CHANGED
|
@@ -11,6 +11,18 @@ RUN apt-get update && apt-get install -y \
|
|
| 11 |
# Set the working directory
|
| 12 |
WORKDIR /app
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
# Copy the requirements file and install dependencies
|
| 15 |
COPY requirements.txt .
|
| 16 |
RUN pip install --no-cache-dir -r requirements.txt
|
|
@@ -18,9 +30,5 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|
| 18 |
# Copy the app code
|
| 19 |
COPY app.py .
|
| 20 |
|
| 21 |
-
# Set environment variables
|
| 22 |
-
ENV HF_HUB_DISABLE_SYMLINKS_WARNING=1
|
| 23 |
-
ENV PYTHONUNBUFFERED=1
|
| 24 |
-
|
| 25 |
# Run the app
|
| 26 |
-
CMD ["python3", "app.py"]
|
|
|
|
| 11 |
# Set the working directory
|
| 12 |
WORKDIR /app
|
| 13 |
|
| 14 |
+
# Create cache directories with proper permissions
|
| 15 |
+
RUN mkdir -p /app/.cache /app/.config /app/flagged && \
|
| 16 |
+
chmod 777 /app/.cache /app/.config /app/flagged
|
| 17 |
+
|
| 18 |
+
# Set environment variables for cache directories
|
| 19 |
+
ENV TRANSFORMERS_CACHE=/app/.cache/huggingface
|
| 20 |
+
ENV HF_HOME=/app/.cache/huggingface
|
| 21 |
+
ENV HUGGINGFACE_HUB_CACHE=/app/.cache/huggingface
|
| 22 |
+
ENV MPLCONFIGDIR=/app/.config/matplotlib
|
| 23 |
+
ENV HF_HUB_DISABLE_SYMLINKS_WARNING=1
|
| 24 |
+
ENV PYTHONUNBUFFERED=1
|
| 25 |
+
|
| 26 |
# Copy the requirements file and install dependencies
|
| 27 |
COPY requirements.txt .
|
| 28 |
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
| 30 |
# Copy the app code
|
| 31 |
COPY app.py .
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
# Run the app
|
| 34 |
+
CMD ["python3", "app.py"]
|