kavin57447 commited on
Commit
0eef0af
·
1 Parent(s): ee3dfa7

Fix matplotlib permission + HF cache dirs

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -1
Dockerfile CHANGED
@@ -7,6 +7,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
7
  build-essential git && \
8
  rm -rf /var/lib/apt/lists/*
9
 
 
 
 
 
 
10
  # Python deps
11
  COPY requirements.txt .
12
  RUN pip install --no-cache-dir -r requirements.txt
@@ -14,7 +19,10 @@ RUN pip install --no-cache-dir -r requirements.txt
14
  # App code
15
  COPY . .
16
 
17
- # HF Spaces expects port 7860
 
 
 
18
  EXPOSE 7860
19
 
20
  CMD ["python", "app.py"]
 
7
  build-essential git && \
8
  rm -rf /var/lib/apt/lists/*
9
 
10
+ # Writable dirs for matplotlib and HF cache
11
+ ENV MPLCONFIGDIR=/tmp/matplotlib
12
+ ENV HF_HOME=/tmp/hf_cache
13
+ RUN mkdir -p /tmp/matplotlib /tmp/hf_cache
14
+
15
  # Python deps
16
  COPY requirements.txt .
17
  RUN pip install --no-cache-dir -r requirements.txt
 
19
  # App code
20
  COPY . .
21
 
22
+ # Writable dirs for outputs
23
+ RUN mkdir -p /app/models /app/outputs /app/logs /app/eval_logs && \
24
+ chmod -R 777 /app/models /app/outputs /app/logs /app/eval_logs /tmp/matplotlib /tmp/hf_cache
25
+
26
  EXPOSE 7860
27
 
28
  CMD ["python", "app.py"]