Doom01 commited on
Commit
7314747
Β·
verified Β·
1 Parent(s): df08128

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +21 -31
Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
  FROM python:3.11-slim
2
-
3
  # ── System dependencies ───────────────────────────────────────────────────────
4
  RUN apt-get update && apt-get install -y \
5
  curl \
@@ -13,7 +13,7 @@ RUN apt-get update && apt-get install -y \
13
  libopenblas-dev \
14
  libgomp1 \
15
  && rm -rf /var/lib/apt/lists/*
16
-
17
  # ── llama-cpp-python ──────────────────────────────────────────────────────────
18
  # IMPORTANT: Do NOT set CMAKE_ARGS here β€” that forces a full C++ source compile
19
  # which takes 15–30 min and times out on HF Spaces.
@@ -22,7 +22,7 @@ RUN apt-get update && apt-get install -y \
22
  RUN pip install --no-cache-dir \
23
  "llama-cpp-python[server]" \
24
  --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
25
-
26
  # ── Server sub-dependencies (explicit safety net) ─────────────────────────────
27
  RUN pip install --no-cache-dir \
28
  sse-starlette \
@@ -33,7 +33,7 @@ RUN pip install --no-cache-dir \
33
  pydantic-settings \
34
  anyio \
35
  httpx
36
-
37
  # ── HuggingFace + utility packages ───────────────────────────────────────────
38
  RUN pip install --no-cache-dir \
39
  huggingface_hub \
@@ -43,42 +43,32 @@ RUN pip install --no-cache-dir \
43
  diskcache \
44
  numpy \
45
  filelock
46
-
47
  # ── Node.js gateway ───────────────────────────────────────────────────────────
48
  WORKDIR /app
49
  COPY package.json .
50
  RUN npm install
51
-
52
  # ── Copy project files ────────────────────────────────────────────────────────
53
  COPY . .
54
-
55
  # ── Create required directories ───────────────────────────────────────────────
56
  RUN mkdir -p /app/models /app/data /app/logs
57
-
58
  # ── Permissions ───────────────────────────────────────────────────────────────
59
  RUN chmod +x start.sh
60
-
61
- # ── Verify llama_cpp installed correctly ─────────────────────────────────────
62
- # Checks the package itself, not an internal API that can change between versions
63
- RUN python3 -c "
64
- import llama_cpp
65
- print('βœ… llama_cpp version:', llama_cpp.__version__)
66
-
67
- # Verify server extras are present
68
- try:
69
- import llama_cpp.server
70
- print('βœ… llama_cpp.server: OK')
71
- except ImportError as e:
72
- raise RuntimeError('llama_cpp.server missing β€” [server] extra not installed: ' + str(e))
73
-
74
- # Verify all other required packages
75
- for mod in ['fastapi', 'uvicorn', 'sse_starlette', 'huggingface_hub', 'schedule', 'filelock']:
76
- __import__(mod)
77
- print(f'βœ… {mod}: OK')
78
-
79
- print('βœ… All checks passed!')
80
- "
81
-
82
  EXPOSE 7860
83
-
84
  CMD ["./start.sh"]
 
1
  FROM python:3.11-slim
2
+
3
  # ── System dependencies ───────────────────────────────────────────────────────
4
  RUN apt-get update && apt-get install -y \
5
  curl \
 
13
  libopenblas-dev \
14
  libgomp1 \
15
  && rm -rf /var/lib/apt/lists/*
16
+
17
  # ── llama-cpp-python ──────────────────────────────────────────────────────────
18
  # IMPORTANT: Do NOT set CMAKE_ARGS here β€” that forces a full C++ source compile
19
  # which takes 15–30 min and times out on HF Spaces.
 
22
  RUN pip install --no-cache-dir \
23
  "llama-cpp-python[server]" \
24
  --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
25
+
26
  # ── Server sub-dependencies (explicit safety net) ─────────────────────────────
27
  RUN pip install --no-cache-dir \
28
  sse-starlette \
 
33
  pydantic-settings \
34
  anyio \
35
  httpx
36
+
37
  # ── HuggingFace + utility packages ───────────────────────────────────────────
38
  RUN pip install --no-cache-dir \
39
  huggingface_hub \
 
43
  diskcache \
44
  numpy \
45
  filelock
46
+
47
  # ── Node.js gateway ───────────────────────────────────────────────────────────
48
  WORKDIR /app
49
  COPY package.json .
50
  RUN npm install
51
+
52
  # ── Copy project files ────────────────────────────────────────────────────────
53
  COPY . .
54
+
55
  # ── Create required directories ───────────────────────────────────────────────
56
  RUN mkdir -p /app/models /app/data /app/logs
57
+
58
  # ── Permissions ───────────────────────────────────────────────────────────────
59
  RUN chmod +x start.sh
60
+
61
+ # ── Verify all packages installed correctly ───────────────────────────────────
62
+ RUN python3 -c "import llama_cpp; print('βœ… llama_cpp', llama_cpp.__version__)" && \
63
+ python3 -c "import llama_cpp.server; print('βœ… llama_cpp.server')" && \
64
+ python3 -c "import fastapi; print('βœ… fastapi')" && \
65
+ python3 -c "import uvicorn; print('βœ… uvicorn')" && \
66
+ python3 -c "import sse_starlette; print('βœ… sse_starlette')" && \
67
+ python3 -c "import huggingface_hub; print('βœ… huggingface_hub')" && \
68
+ python3 -c "import schedule; print('βœ… schedule')" && \
69
+ python3 -c "import filelock; print('βœ… filelock')" && \
70
+ echo "βœ… All checks passed!"
71
+
 
 
 
 
 
 
 
 
 
 
72
  EXPOSE 7860
73
+
74
  CMD ["./start.sh"]