muddasser commited on
Commit
25c2194
·
verified ·
1 Parent(s): 804e38b

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -33
Dockerfile CHANGED
@@ -1,38 +1,19 @@
1
  FROM python:3.11-slim
2
-
3
- RUN apt-get update && apt-get install -y --no-install-recommends \
4
- ffmpeg libsndfile1 curl \
5
- && rm -rf /var/lib/apt/lists/*
6
-
7
- RUN useradd -m -u 1000 user
8
  USER user
9
- ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH PYTHONUNBUFFERED=1
10
-
11
- WORKDIR $HOME/app
12
-
 
 
13
  COPY --chown=user requirements.txt .
14
- RUN pip install --no-cache-dir --upgrade pip \
15
- && pip install --no-cache-dir -r requirements.txt
16
-
17
- # Patch Gradio 4.44.x stop_event bug in routes.py
18
- RUN python3 - << 'PYEOF'
19
- import site, pathlib
20
-
21
- # Find gradio routes.py
22
- for p in site.getsitepackages():
23
- f = pathlib.Path(p) / "gradio" / "routes.py"
24
- if f.exists():
25
- src = f.read_text()
26
- # Patch: guard stop_event before calling .wait()
27
- old = "await app.stop_event.wait()"
28
- new = "await app.stop_event.wait() if app.stop_event else None"
29
- if old in src:
30
- f.write_text(src.replace(old, new))
31
- print(f"Patched {f}")
32
- break
33
- PYEOF
34
-
35
  COPY --chown=user . .
36
-
37
  EXPOSE 7860
38
- CMD ["python", "app.py"]
 
1
  FROM python:3.11-slim
2
+
3
+ # Non-root user (required by Hugging Face Spaces) and the folder for the transcript database.
4
+ # Enable "Persistent Storage" on the Space so /data survives restarts.
5
+ RUN useradd -m -u 1000 user && mkdir -p /data && chown user /data
 
 
6
  USER user
7
+
8
+ ENV PATH=/home/user/.local/bin:$PATH \
9
+ INTERVIEWS_DB_PATH=/data/interviews.db
10
+
11
+ WORKDIR /home/user/app
12
+
13
  COPY --chown=user requirements.txt .
14
+ RUN pip install --no-cache-dir -r requirements.txt
15
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  COPY --chown=user . .
17
+
18
  EXPOSE 7860
19
+ CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0", "--server.headless=true", "--server.enableCORS=false", "--server.enableXsrfProtection=false"]