PoppaYAO commited on
Commit
c59a45c
·
verified ·
1 Parent(s): e6c8a8d

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -12
Dockerfile CHANGED
@@ -1,29 +1,30 @@
1
- # Switch to Alpine Linux to match the downloaded wheel
2
- FROM python:3.11-alpine
 
3
 
4
- # Install system tools (using 'apk' instead of 'apt-get')
5
- # We add 'gcc' and 'g++' just in case any other package needs a quick compile
6
- RUN apk add --no-cache \
7
  curl \
8
  git \
9
  nodejs \
10
  npm \
11
- gcc \
12
- g++ \
13
- musl-dev
14
 
15
  # Install promptfoo globally
16
  RUN npm install -g promptfoo
17
 
18
  WORKDIR /app
19
 
20
- # Install llama-cpp-python
21
- # Now that we are on Alpine, the 'musl' wheel it downloaded before will work perfectly.
22
- RUN pip install --no-cache-dir \
 
 
 
23
  "llama-cpp-python" \
24
  --extra-index-url "https://abetlen.github.io/llama-cpp-python/whl/cpu"
25
 
26
- # Install your requirements
27
  COPY requirements.txt .
28
  RUN pip install --no-cache-dir -r requirements.txt
29
 
 
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
6
+ RUN apt-get update && apt-get install -y \
 
7
  curl \
8
  git \
9
  nodejs \
10
  npm \
11
+ && rm -rf /var/lib/apt/lists/*
 
 
12
 
13
  # Install promptfoo globally
14
  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 .
29
  RUN pip install --no-cache-dir -r requirements.txt
30