fomext commited on
Commit
36a3b55
Β·
verified Β·
1 Parent(s): cec3ab3

Upload Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -11
Dockerfile CHANGED
@@ -21,20 +21,19 @@ RUN pip install --no-cache-dir \
21
  pydantic==2.7.1
22
 
23
  # Install llama-cpp-python CPU-only (compiled from source)
24
- RUN CMAKE_ARGS="-DLLAMA_CUBLAS=OFF -DLLAMA_METAL=OFF -DLLAMA_OPENCL=OFF" \
 
 
25
  FORCE_CMAKE=1 \
26
- pip install --no-cache-dir llama-cpp-python==0.2.77
27
 
28
  # ── App code ─────────────────────────────────────────────────
29
  COPY app.py .
30
 
31
- # ── Model volume ─────────────────────────────────────────────
32
- # The app auto-downloads the model on first boot into /models.
33
- # Mount a named volume here so the download persists across restarts:
34
- # docker run -v qwen3_models:/models ...
35
- # Or pre-populate with your own GGUF:
36
- # docker run -v /path/to/models:/models ...
37
- RUN mkdir -p /models
38
 
39
  # ── Runtime env defaults (override with -e or docker-compose) ─
40
  ENV MODEL_PATH=/data/qwen3-14b-q4_k_m.gguf \
@@ -45,10 +44,10 @@ ENV MODEL_PATH=/data/qwen3-14b-q4_k_m.gguf \
45
  N_BATCH=512 \
46
  VERBOSE=false
47
 
48
- EXPOSE 8000
49
 
50
  # Health check β€” /health returns {"ready": true} once the model is loaded
51
  HEALTHCHECK --interval=30s --timeout=10s --start-period=600s --retries=20 \
52
- CMD wget -qO- http://localhost:8000/health | grep -q '"ready": true' || exit 1
53
 
54
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
21
  pydantic==2.7.1
22
 
23
  # Install llama-cpp-python CPU-only (compiled from source)
24
+ # 0.3.4: new enough to read current GGUF format, avoids the
25
+ # malloc/GGML_ASSERT corruption crash introduced in 0.3.9
26
+ RUN CMAKE_ARGS="-DGGML_CUDA=OFF -DGGML_METAL=OFF -DGGML_OPENCL=OFF" \
27
  FORCE_CMAKE=1 \
28
+ pip install --no-cache-dir llama-cpp-python==0.3.4
29
 
30
  # ── App code ─────────────────────────────────────────────────
31
  COPY app.py .
32
 
33
+ # ── Storage ──────────────────────────────────────────────────
34
+ # /data is the HF Spaces persistent storage bucket.
35
+ # Model is downloaded here on first boot and reused on restarts.
36
+ RUN mkdir -p /data
 
 
 
37
 
38
  # ── Runtime env defaults (override with -e or docker-compose) ─
39
  ENV MODEL_PATH=/data/qwen3-14b-q4_k_m.gguf \
 
44
  N_BATCH=512 \
45
  VERBOSE=false
46
 
47
+ EXPOSE 7860
48
 
49
  # Health check β€” /health returns {"ready": true} once the model is loaded
50
  HEALTHCHECK --interval=30s --timeout=10s --start-period=600s --retries=20 \
51
+ CMD wget -qO- http://localhost:7860/health | grep -q '"ready": true' || exit 1
52
 
53
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]