Quartz4065 commited on
Commit
4f5ee19
·
verified ·
1 Parent(s): 033e455

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -20
Dockerfile CHANGED
@@ -1,32 +1,26 @@
1
  FROM python:3.11-slim
2
 
3
- WORKDIR /app
4
- COPY requirements.txt .
5
- RUN pip install --no-cache-dir -r requirements.txt
6
-
7
- # OS deps
8
  RUN apt-get update && apt-get install -y --no-install-recommends \
9
- ffmpeg libsndfile1 && rm -rf /var/lib/apt/lists/*
 
10
 
11
- # Writable caches for HF & general
 
 
 
12
  ENV HF_HOME=/data/hf
13
  ENV HUGGINGFACE_HUB_CACHE=/data/hf
14
- ENV XDG_CACHE_HOME=/data/.cache
15
- ENV HF_HUB_DISABLE_TELEMETRY=1
16
- ENV HF_HUB_DISABLE_PROGRESS_BARS=1
17
-
18
- RUN mkdir -p /data/hf /data/.cache && chmod -R 777 /data
19
 
20
- # ---- PRE-FETCH MODEL AS ROOT, THEN FIX PERMS ----
21
- RUN python - <<'PY'
22
- from faster_whisper.utils import download_model
23
- download_model("tiny.en", cache_dir="/data/hf")
24
- print("Model pre-fetched into /data/hf")
25
- PY
26
- # make sure runtime user can read/write the cache
27
- RUN chmod -R 777 /data
28
 
 
29
  COPY app.py .
30
 
 
31
  ENV PORT=7860
32
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
  FROM python:3.11-slim
2
 
3
+ # System deps for ffmpeg & audio
 
 
 
 
4
  RUN apt-get update && apt-get install -y --no-install-recommends \
5
+ ffmpeg libsndfile1 ca-certificates \
6
+ && rm -rf /var/lib/apt/lists/*
7
 
8
+ # App dir
9
+ WORKDIR /app
10
+
11
+ # Writable cache path for HF models
12
  ENV HF_HOME=/data/hf
13
  ENV HUGGINGFACE_HUB_CACHE=/data/hf
14
+ ENV TRANSFORMERS_CACHE=/data/hf
15
+ RUN mkdir -p /data/hf && chmod -R 777 /data
 
 
 
16
 
17
+ # Python deps
18
+ COPY requirements.txt .
19
+ RUN pip install --no-cache-dir -r requirements.txt
 
 
 
 
 
20
 
21
+ # App
22
  COPY app.py .
23
 
24
+ # Expose port expected by HF Spaces
25
  ENV PORT=7860
26
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]