CyberCoder225 commited on
Commit
4f5bf6b
·
verified ·
1 Parent(s): 167cb59

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +8 -5
Dockerfile CHANGED
@@ -1,11 +1,14 @@
 
1
  FROM python:3.10-alpine
2
 
3
- # 1. Install build tools + compatibility layers + math libs
4
- # musl-dev and build-base are MANDATORY to fix the "Could not find compiler" error
5
  RUN apk add --no-cache \
6
  build-base \
7
  cmake \
8
  musl-dev \
 
 
9
  libc6-compat \
10
  libstdc++ \
11
  libgomp \
@@ -18,12 +21,12 @@ ENV HOME=/home/user \
18
  PATH=/home/user/.local/bin:$PATH
19
  WORKDIR $HOME/app
20
 
21
- # 2. Set environment variables to optimize the build for Alpine's CPU
22
  ENV CMAKE_ARGS="-DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS"
23
 
24
  # 3. Install packages
25
- # Note: This will take a few minutes because it has to compile.
26
- # This is the ONLY way to make it work on Alpine.
27
  RUN pip install --no-cache-dir --upgrade pip && \
28
  pip install --no-cache-dir flask flask-cors huggingface-hub && \
29
  pip install --no-cache-dir llama-cpp-python
 
1
+ # Use a specific version for better stability
2
  FROM python:3.10-alpine
3
 
4
+ # 1. Install EVERY build dependency needed for a C++ compile on Alpine
5
+ # we add linux-headers and python3-dev to prevent "missing header" errors
6
  RUN apk add --no-cache \
7
  build-base \
8
  cmake \
9
  musl-dev \
10
+ python3-dev \
11
+ linux-headers \
12
  libc6-compat \
13
  libstdc++ \
14
  libgomp \
 
21
  PATH=/home/user/.local/bin:$PATH
22
  WORKDIR $HOME/app
23
 
24
+ # 2. Tell the compiler to use Alpine's math libraries
25
  ENV CMAKE_ARGS="-DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS"
26
 
27
  # 3. Install packages
28
+ # WARNING: This will take 15 minutes. The logs will look "stuck".
29
+ # DO NOT REBOOT. Let it finish the "Building wheel" stage.
30
  RUN pip install --no-cache-dir --upgrade pip && \
31
  pip install --no-cache-dir flask flask-cors huggingface-hub && \
32
  pip install --no-cache-dir llama-cpp-python