truegleai commited on
Commit
1e3c6e8
·
verified ·
1 Parent(s): 1d9ff12

Deploy FastAPI server with CodeLlama 7B

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -6
Dockerfile CHANGED
@@ -1,20 +1,32 @@
1
- # Dockerfile for HuggingFace Spaces
2
- FROM python:3.10-slim
3
 
4
  # Set working directory
5
  WORKDIR /app
6
 
7
- # Install system dependencies
8
  RUN apt-get update && apt-get install -y \
9
  build-essential \
10
- curl \
11
  git \
 
12
  && rm -rf /var/lib/apt/lists/*
13
 
14
- # Copy requirements and install Python dependencies
15
  COPY requirements.txt .
 
 
16
  RUN pip install --no-cache-dir --upgrade pip && \
17
- pip install --no-cache-dir -r requirements.txt
 
 
 
 
 
 
 
 
 
18
 
19
  # Copy application code
20
  COPY app.py .
 
1
+ # Dockerfile for HuggingFace Spaces - Build llama-cpp-python from source
2
+ FROM python:3.11-slim-bookworm
3
 
4
  # Set working directory
5
  WORKDIR /app
6
 
7
+ # Install system dependencies including CMAKE build tools
8
  RUN apt-get update && apt-get install -y \
9
  build-essential \
10
+ cmake \
11
  git \
12
+ curl \
13
  && rm -rf /var/lib/apt/lists/*
14
 
15
+ # Copy requirements FIRST (for better caching)
16
  COPY requirements.txt .
17
+
18
+ # Install Python dependencies EXCEPT llama-cpp-python
19
  RUN pip install --no-cache-dir --upgrade pip && \
20
+ grep -v "llama-cpp-python" requirements.txt > requirements_temp.txt && \
21
+ pip install --no-cache-dir -r requirements_temp.txt && \
22
+ rm requirements_temp.txt
23
+
24
+ # Build llama-cpp-python from source with CMAKE (this is the key!)
25
+ # Force CMAKE build to ensure it compiles against glibc, not using musl wheels
26
+ RUN CMAKE_ARGS="-DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS" \
27
+ FORCE_CMAKE=1 \
28
+ pip install --no-cache-dir --force-reinstall --upgrade --verbose \
29
+ llama-cpp-python==0.2.90
30
 
31
  # Copy application code
32
  COPY app.py .