Sanjayan201 commited on
Commit
e4d0e45
·
verified ·
1 Parent(s): dfa641f

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +3 -6
Dockerfile CHANGED
@@ -1,5 +1,3 @@
1
- # Dockerfile
2
-
3
  FROM python:3.9
4
 
5
  # Create a working directory
@@ -13,14 +11,13 @@ RUN pip install --no-cache-dir -r requirements.txt
13
  COPY . .
14
 
15
  ############################################
16
- # 1) Tell Transformers & HF libraries to use /app/.cache instead of /.cache
17
  ENV HF_HOME=/app/.cache/huggingface
18
  ENV TRANSFORMERS_CACHE=/app/.cache/huggingface
19
  ENV TORCH_HOME=/app/.cache/torch
20
 
21
- # 2) Make the .cache directories
22
- RUN mkdir -p /app/.cache/huggingface
23
- RUN mkdir -p /app/.cache/torch
24
 
25
  # Expose port 7860 for HF Spaces
26
  EXPOSE 7860
 
 
 
1
  FROM python:3.9
2
 
3
  # Create a working directory
 
11
  COPY . .
12
 
13
  ############################################
14
+ # Set environment variables to use a custom cache location
15
  ENV HF_HOME=/app/.cache/huggingface
16
  ENV TRANSFORMERS_CACHE=/app/.cache/huggingface
17
  ENV TORCH_HOME=/app/.cache/torch
18
 
19
+ # Create the cache directories and set permissions so they are writable.
20
+ RUN mkdir -p /app/.cache/huggingface && mkdir -p /app/.cache/torch && chmod -R 777 /app/.cache
 
21
 
22
  # Expose port 7860 for HF Spaces
23
  EXPOSE 7860