CyberCoder225 commited on
Commit
f17d2c8
·
verified ·
1 Parent(s): 36de5b9

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -15
Dockerfile CHANGED
@@ -1,27 +1,31 @@
1
- # Use Bookworm (Debian 12) - it's more stable for AI builds than Slim
2
- FROM python:3.10-bookworm
3
 
4
- # Install basic build tools and libraries
5
- RUN apt-get update && apt-get install -y \
6
- build-essential \
 
 
7
  cmake \
8
- libgomp1 \
9
- && rm -rf /var/lib/apt/lists/*
 
 
10
 
11
- RUN useradd -m -u 1000 user
12
  USER user
13
  ENV HOME=/home/user \
14
  PATH=/home/user/.local/bin:$PATH
15
  WORKDIR $HOME/app
16
 
17
- # We install a specific stable version (0.3.2) that has wide wheel support
18
- # This avoids the "Building Wheel" trap.
 
 
 
 
19
  RUN pip install --no-cache-dir --upgrade pip && \
20
- pip install --no-cache-dir \
21
- flask \
22
- flask-cors \
23
- huggingface-hub \
24
- llama-cpp-python==0.3.2 --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
25
 
26
  COPY --chown=user . $HOME/app
27
 
 
1
+ FROM python:3.10-alpine
 
2
 
3
+ # 1. Install Alpine-specific build tools
4
+ # build-base = gcc, g++, make
5
+ # openblas-dev = fast math for the CPU
6
+ RUN apk add --no-cache \
7
+ build-base \
8
  cmake \
9
+ git \
10
+ libstdc++ \
11
+ openblas-dev \
12
+ python3-dev
13
 
14
+ RUN adduser -D -u 1000 user
15
  USER user
16
  ENV HOME=/home/user \
17
  PATH=/home/user/.local/bin:$PATH
18
  WORKDIR $HOME/app
19
 
20
+ # 2. Set environment variables to tell llama-cpp to use the Alpine math libraries
21
+ ENV CMAKE_ARGS="-DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS"
22
+
23
+ # 3. Install Python packages
24
+ # This WILL take 5-10 minutes because Alpine has to build the AI engine from scratch.
25
+ # DO NOT cancel it when you see "Building wheel for llama-cpp-python".
26
  RUN pip install --no-cache-dir --upgrade pip && \
27
+ pip install --no-cache-dir flask flask-cors huggingface-hub && \
28
+ pip install --no-cache-dir llama-cpp-python
 
 
 
29
 
30
  COPY --chown=user . $HOME/app
31