Clearwave48 commited on
Commit
5b73e2d
Β·
verified Β·
1 Parent(s): 47ab527

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -17
Dockerfile CHANGED
@@ -1,37 +1,34 @@
1
  FROM python:3.10-slim
2
 
3
  # ── System deps ────────────────────────────────────────────────────────────────
4
- # Rust + cargo needed for DeepFilterNet (df package)
5
- # build-essential needed for speechbrain native extensions
6
  RUN apt-get update && apt-get install -y \
7
  ffmpeg git curl \
8
- build-essential \
9
- && curl https://sh.rustup.rs -sSf | sh -s -- -y \
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
- # Put cargo/rustc on PATH for subsequent RUN steps
13
- ENV PATH="/root/.cargo/bin:${PATH}"
14
-
15
  WORKDIR /app
16
 
17
- # ── PyTorch CPU ────────────────────────────────────────────────────────────────
18
  RUN pip install --no-cache-dir torch torchaudio \
19
  --index-url https://download.pytorch.org/whl/cpu
20
 
21
- # ── Core app deps (unchanged from your original) ──────────────────────────────
22
  RUN pip install --no-cache-dir \
23
  fastapi uvicorn \
24
- requests \
 
25
  groq \
26
  deep-translator transformers tokenizers \
27
  huggingface_hub sentencepiece sacremoses \
28
- soundfile noisereduce numpy pyloudnorm \
29
  librosa ffmpeg-python faster-whisper \
30
- cloudinary
31
-
32
 
33
  COPY . .
34
 
 
 
 
35
  RUN useradd -m -u 1000 user
36
  USER user
37
 
@@ -39,10 +36,6 @@ ENV HF_HOME=/app/.cache/huggingface
39
  ENV TRANSFORMERS_CACHE=/app/.cache/huggingface
40
  ENV HOME=/home/user
41
 
42
- # Pre-download DeepFilterNet weights at build time so first request isn't slow
43
- # (runs as root before USER switch β€” weights land in /app/.cache)
44
- RUN python -c "from df.enhance import init_df; init_df()" || true
45
-
46
  EXPOSE 7860
47
 
48
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
  FROM python:3.10-slim
2
 
3
  # ── System deps ────────────────────────────────────────────────────────────────
 
 
4
  RUN apt-get update && apt-get install -y \
5
  ffmpeg git curl \
 
 
6
  && rm -rf /var/lib/apt/lists/*
7
 
 
 
 
8
  WORKDIR /app
9
 
10
+ # ── PyTorch CPU (needed by faster-whisper / transformers) ─────────────────────
11
  RUN pip install --no-cache-dir torch torchaudio \
12
  --index-url https://download.pytorch.org/whl/cpu
13
 
14
+ # ── Core app deps ──────────────────────────────────────────────────────────────
15
  RUN pip install --no-cache-dir \
16
  fastapi uvicorn \
17
+ requests httpx \
18
+ python-multipart aiofiles \
19
  groq \
20
  deep-translator transformers tokenizers \
21
  huggingface_hub sentencepiece sacremoses \
22
+ soundfile numpy \
23
  librosa ffmpeg-python faster-whisper \
24
+ cloudinary \
25
+ cleanvoice-sdk
26
 
27
  COPY . .
28
 
29
+ # ── Fix cache dir permissions before switching user ────────────────────────────
30
+ RUN mkdir -p /app/.cache/huggingface && chown -R 1000:1000 /app
31
+
32
  RUN useradd -m -u 1000 user
33
  USER user
34
 
 
36
  ENV TRANSFORMERS_CACHE=/app/.cache/huggingface
37
  ENV HOME=/home/user
38
 
 
 
 
 
39
  EXPOSE 7860
40
 
41
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]