PoppaYAO commited on
Commit
2f1ff94
·
verified ·
1 Parent(s): efc8576

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -10
Dockerfile CHANGED
@@ -1,5 +1,3 @@
1
- # Use Python 3.11 Slim (Debian-based)
2
- # WHY: The pre-built AI engine is built for Debian (glibc), not Alpine (musl).
3
  FROM python:3.11-slim
4
 
5
  # Install Node.js (for promptfoo) and system tools
@@ -15,14 +13,20 @@ RUN npm install -g promptfoo
15
 
16
  WORKDIR /app
17
 
18
- # --- CRITICAL INSTALLATION STEP ---
19
- # We install the AI engine separately with three safety flags:
20
- # 1. --extra-index-url: Points to the pre-built CPU library.
21
- # 2. --only-binary :all: STRICTLY forbids compilation. If the pre-built file isn't found, it will error immediately (fail fast) rather than trying to compile for 30 mins.
22
- # 3. --no-cache-dir: Keeps the image small.
23
- RUN pip install --no-cache-dir --only-binary :all: \
 
 
 
24
  "llama-cpp-python" \
25
- --extra-index-url "https://abetlen.github.io/llama-cpp-python/whl/cpu"
 
 
 
26
 
27
  # --- Install Standard Requirements ---
28
  COPY requirements.txt .
@@ -33,5 +37,4 @@ COPY . .
33
 
34
  EXPOSE 7860
35
 
36
- # Run server
37
  CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
 
1
  FROM python:3.11-slim
2
 
3
  # Install Node.js (for promptfoo) and system tools
 
13
 
14
  WORKDIR /app
15
 
16
+ # --- ULTIMATE FIX: Force Specific Platform ---
17
+ # We do not trust pip to choose. We force it to download the 'manylinux' (Debian) version.
18
+ # 1. Download the specific wheel for Debian (manylinux_2_17_x86_64).
19
+ # 2. Install the downloaded file directly.
20
+ RUN pip download --only-binary :all: \
21
+ --platform manylinux_2_17_x86_64 \
22
+ --python-version 311 \
23
+ --implementation cp \
24
+ --abi cp311 \
25
  "llama-cpp-python" \
26
+ --extra-index-url "https://abetlen.github.io/llama-cpp-python/whl/cpu" \
27
+ -d /tmp/wheels
28
+
29
+ RUN pip install --no-cache-dir /tmp/wheels/llama*.whl && rm -rf /tmp/wheels
30
 
31
  # --- Install Standard Requirements ---
32
  COPY requirements.txt .
 
37
 
38
  EXPOSE 7860
39
 
 
40
  CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "7860"]