omaryasserhassan commited on
Commit
92c55d8
·
verified ·
1 Parent(s): fcea2ac

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +21 -4
Dockerfile CHANGED
@@ -1,20 +1,37 @@
1
  FROM python:3.11-slim
2
 
3
- # System deps for some wheels/builds
4
  RUN apt-get update && apt-get install -y --no-install-recommends \
5
  build-essential cmake git && \
6
  rm -rf /var/lib/apt/lists/*
7
 
8
  WORKDIR /app
9
 
10
- # Python deps
11
  COPY requirements.txt .
12
  RUN pip install --no-cache-dir -r requirements.txt
13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  # App code
15
  COPY app.py .
16
 
17
  EXPOSE 7860
18
-
19
- # Run FastAPI
20
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
  FROM python:3.11-slim
2
 
3
+ # System deps for llama-cpp build
4
  RUN apt-get update && apt-get install -y --no-install-recommends \
5
  build-essential cmake git && \
6
  rm -rf /var/lib/apt/lists/*
7
 
8
  WORKDIR /app
9
 
10
+ # App deps
11
  COPY requirements.txt .
12
  RUN pip install --no-cache-dir -r requirements.txt
13
 
14
+ # --- Bake model into the image (change these ENV if you prefer Phi-3 mini) ---
15
+ ENV MODEL_REPO=Qwen/Qwen2.5-3B-Instruct-GGUF
16
+ ENV MODEL_FILE=qwen2.5-3b-instruct-q4_k_m.gguf
17
+
18
+ # Download GGUF at build time to /app/models (no symlinks)
19
+ RUN python - <<'PY'
20
+ from huggingface_hub import snapshot_download
21
+ import os
22
+ local_dir = "/app/models"
23
+ os.makedirs(local_dir, exist_ok=True)
24
+ snapshot_download(
25
+ repo_id=os.environ.get("MODEL_REPO"),
26
+ allow_patterns=[os.environ.get("MODEL_FILE")],
27
+ local_dir=local_dir,
28
+ local_dir_use_symlinks=False,
29
+ )
30
+ print("Model baked into image at /app/models")
31
+ PY
32
+
33
  # App code
34
  COPY app.py .
35
 
36
  EXPOSE 7860
 
 
37
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]