ramedde commited on
Commit
a65b0b7
·
verified ·
1 Parent(s): 79ecd65

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +23 -29
Dockerfile CHANGED
@@ -1,37 +1,31 @@
1
  FROM python:3.11-slim
2
 
3
- RUN apt-get update && apt-get install -y \
4
- git \
5
- git-lfs \
6
- ffmpeg \
7
- libsm6 \
8
- libxext6 \
9
- cmake \
10
- rsync \
11
- libgl1 \
12
- g++ \
13
- gcc \
14
- build-essential \
15
- && rm -rf /var/lib/apt/lists/* \
16
- && git lfs install
17
-
18
- RUN useradd -m -u 1000 user
19
-
20
  WORKDIR /app
21
 
22
- ENV GRADIO_SERVER_NAME="0.0.0.0"
23
- ENV GRADIO_SERVER_PORT="7860"
24
-
25
- RUN pip install --no-cache-dir --upgrade pip
26
-
27
- COPY requirements.txt .
28
- RUN pip install --no-cache-dir -r requirements.txt
29
-
30
- COPY --chown=user:user . /app
31
-
32
- USER user
 
 
 
 
 
 
 
 
 
 
 
 
33
 
34
  EXPOSE 7860
35
 
36
-
37
  CMD ["python", "app.py"]
 
1
  FROM python:3.11-slim
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  WORKDIR /app
4
 
5
+ # Install dependencies
6
+ RUN pip install --no-cache-dir \
7
+ gradio==4.44.1 \
8
+ llama-cpp-python \
9
+ huggingface_hub \
10
+ gtts \
11
+ pyaudioop
12
+
13
+ # Download the model at build time (guarantees it's present before app starts)
14
+ RUN python -c "\
15
+ from huggingface_hub import hf_hub_download; \
16
+ import os; \
17
+ path = hf_hub_download( \
18
+ repo_id='Qwen/Qwen2.5-0.5B-Instruct-GGUF', \
19
+ filename='qwen2.5-0.5b-instruct-q4_k_m.gguf', \
20
+ local_dir='/app', \
21
+ local_dir_use_symlinks=False, \
22
+ ); \
23
+ os.rename(path, '/app/model.gguf') if path != '/app/model.gguf' else None; \
24
+ print('Model downloaded:', os.path.getsize('/app/model.gguf') / 1024 / 1024, 'MB') \
25
+ "
26
+
27
+ COPY app.py .
28
 
29
  EXPOSE 7860
30
 
 
31
  CMD ["python", "app.py"]