Soham Kolte
commited on
Commit
·
6f75232
1
Parent(s):
c716155
Fix cache permission error with explicit directory creation
Browse files- Dockerfile +6 -1
Dockerfile
CHANGED
@@ -5,10 +5,15 @@ FROM python:3.10-slim
|
|
5 |
WORKDIR /code
|
6 |
|
7 |
# --- FIX FOR PERMISSION ERROR ---
|
8 |
-
# Set
|
9 |
ENV HF_HOME=/tmp/huggingface_cache
|
10 |
ENV TORCH_HOME=/tmp/torch_cache
|
11 |
|
|
|
|
|
|
|
|
|
|
|
12 |
# Install system dependencies required by OpenCV
|
13 |
RUN apt-get update && apt-get install -y \
|
14 |
libgl1-mesa-glx \
|
|
|
5 |
WORKDIR /code
|
6 |
|
7 |
# --- FIX FOR PERMISSION ERROR ---
|
8 |
+
# 1. Set environment variables to tell libraries where to cache files.
|
9 |
ENV HF_HOME=/tmp/huggingface_cache
|
10 |
ENV TORCH_HOME=/tmp/torch_cache
|
11 |
|
12 |
+
# 2. Explicitly create the cache directory and give it open permissions.
|
13 |
+
# This is safe within a container and ensures the application can write here.
|
14 |
+
RUN mkdir -p $HF_HOME && chmod -R 777 $HF_HOME
|
15 |
+
RUN mkdir -p $TORCH_HOME && chmod -R 777 $TORCH_HOME
|
16 |
+
|
17 |
# Install system dependencies required by OpenCV
|
18 |
RUN apt-get update && apt-get install -y \
|
19 |
libgl1-mesa-glx \
|