drrobot9 commited on
Commit
bd9efcf
·
verified ·
1 Parent(s): c5071d5

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +23 -19
Dockerfile CHANGED
@@ -1,50 +1,54 @@
1
- # Base Image
2
- FROM python:3.10-slim
3
 
4
  ENV DEBIAN_FRONTEND=noninteractive \
5
  PYTHONUNBUFFERED=1 \
6
- PYTHONDONTWRITEBYTECODE=1
 
 
 
 
7
 
8
  WORKDIR /code
9
 
10
 
11
- # System Dependencies
12
 
13
  RUN apt-get update && apt-get install -y --no-install-recommends \
14
- build-essential \
15
- git \
16
- curl \
17
- libopenblas-dev \
18
- libomp-dev \
19
  libsndfile1 \
20
  ffmpeg \
21
  sox \
22
  libsox-fmt-all \
23
- libsox-dev \
 
24
  && rm -rf /var/lib/apt/lists/*
25
 
26
 
 
27
  COPY requirements.txt .
28
- RUN pip install --no-cache-dir -r requirements.txt
 
29
 
30
 
31
- # Hugging Face Cache Setup
32
 
33
- ENV HF_HOME=/models \
34
- TRANSFORMERS_CACHE=/models \
35
- HUGGINGFACE_HUB_CACHE=/models \
36
- HF_HUB_CACHE=/models
37
 
38
- RUN mkdir -p /models && chmod -R 777 /models
 
 
 
 
 
 
 
 
39
 
40
 
41
- # Copy App Code
42
 
43
  COPY . .
44
 
 
45
  EXPOSE 7860
46
 
47
 
48
- # Start Server
49
 
50
  CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+
2
+ FROM python:3.10-slim-bullseye
3
 
4
  ENV DEBIAN_FRONTEND=noninteractive \
5
  PYTHONUNBUFFERED=1 \
6
+ PYTHONDONTWRITEBYTECODE=1 \
7
+ PIP_NO_CACHE_DIR=1 \
8
+ HF_HOME=/opt/models \
9
+ TRANSFORMERS_CACHE=/opt/models \
10
+ HUGGINGFACE_HUB_CACHE=/opt/models
11
 
12
  WORKDIR /code
13
 
14
 
 
15
 
16
  RUN apt-get update && apt-get install -y --no-install-recommends \
 
 
 
 
 
17
  libsndfile1 \
18
  ffmpeg \
19
  sox \
20
  libsox-fmt-all \
21
+ curl \
22
+ ca-certificates \
23
  && rm -rf /var/lib/apt/lists/*
24
 
25
 
26
+
27
  COPY requirements.txt .
28
+ RUN pip install --upgrade pip \
29
+ && pip install --no-cache-dir -r requirements.txt
30
 
31
 
 
32
 
33
+ # Pre-download Model at BUILD TIME
 
 
 
34
 
35
+ RUN python - <<EOF
36
+ from huggingface_hub import snapshot_download
37
+ snapshot_download(
38
+ repo_id="Qwen/Qwen3-TTS-12Hz-0.6B-Base",
39
+ local_dir="/opt/models/Qwen3-TTS-12Hz-0.6B-Base",
40
+ local_dir_use_symlinks=False
41
+ )
42
+ print("Qwen model downloaded successfully.")
43
+ EOF
44
 
45
 
 
46
 
47
  COPY . .
48
 
49
+
50
  EXPOSE 7860
51
 
52
 
 
53
 
54
  CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]