Quartz4065 commited on
Commit
e510c89
·
verified ·
1 Parent(s): 05c8543

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -7
Dockerfile CHANGED
@@ -1,19 +1,25 @@
1
  FROM python:3.11-slim
2
 
3
  WORKDIR /app
4
-
5
  COPY requirements.txt .
6
  RUN pip install --no-cache-dir -r requirements.txt
7
 
8
- # ffmpeg + libsndfile for decoding
9
  RUN apt-get update && apt-get install -y --no-install-recommends \
10
  ffmpeg libsndfile1 && rm -rf /var/lib/apt/lists/*
11
 
12
- # Ensure model caches are writable inside Spaces
13
- ENV HF_HOME=/tmp/hf
14
- ENV HUGGINGFACE_HUB_CACHE=/tmp/hf
15
- ENV XDG_CACHE_HOME=/tmp/.cache
16
- RUN mkdir -p /tmp/hf /tmp/.cache
 
 
 
 
 
 
 
17
 
18
  COPY app.py .
19
 
 
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
+ # Force all caches to writable, persistent storage
12
+ ENV HF_HOME=/data/hf
13
+ ENV HUGGINGFACE_HUB_CACHE=/data/hf
14
+ ENV XDG_CACHE_HOME=/data/.cache
15
+ RUN mkdir -p /data/hf /data/.cache && chmod -R 777 /data
16
+
17
+ # Pre-download the tiny.en model into /data to avoid runtime writes
18
+ RUN python - <<'PY'
19
+ from faster_whisper.utils import download_model
20
+ download_model("tiny.en", cache_dir="/data/hf")
21
+ print("Model pre-fetched into /data/hf")
22
+ PY
23
 
24
  COPY app.py .
25