devray11 commited on
Commit
b774f53
·
verified ·
1 Parent(s): bcc2a47

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -3
Dockerfile CHANGED
@@ -1,13 +1,25 @@
1
- FROM python:3.9
 
 
 
 
 
 
 
2
 
3
  WORKDIR /code
4
 
 
5
  COPY ./requirements.txt /code/requirements.txt
6
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
7
 
8
- # This line is critical for CPU performance
9
- RUN CMAKE_ARGS="-DLLAMA_BLAS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS" pip install llama-cpp-python
 
 
 
10
 
11
  COPY . .
12
 
 
13
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ FROM python:3.9-slim
2
+
3
+ # 1. Install system tools needed to build C++ code
4
+ RUN apt-get update && apt-get install -y \
5
+ build-essential \
6
+ cmake \
7
+ python3-dev \
8
+ && rm -rf /var/lib/apt/lists/*
9
 
10
  WORKDIR /code
11
 
12
+ # 2. Install requirements
13
  COPY ./requirements.txt /code/requirements.txt
14
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
15
 
16
+ # 3. Build llama-cpp-python with specific CPU settings
17
+ # This ensures it doesn't look for a GPU (which the free tier doesn't have)
18
+ RUN CMAKE_ARGS="-DLLAMA_BLAS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS" \
19
+ FORCE_CMAKE=1 \
20
+ pip install llama-cpp-python --no-cache-dir
21
 
22
  COPY . .
23
 
24
+ # 4. Start the server
25
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]