ishka2009 commited on
Commit
967399f
·
verified ·
1 Parent(s): de5865a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -19
Dockerfile CHANGED
@@ -1,35 +1,30 @@
1
- FROM python:3.11
2
 
3
  ENV DEBIAN_FRONTEND=noninteractive \
4
- FORCE_CMAKE=1 \
5
  PYTHONUNBUFFERED=1
6
 
7
  WORKDIR /app
8
 
9
- # Install build tools and libs needed by llama-cpp-python
10
  RUN apt-get update && apt-get install -y --no-install-recommends \
11
- build-essential \
12
- cmake \
13
- git \
14
- pkg-config \
15
- libopenblas-dev \
16
- libomp-dev \
17
- libgomp1 \
18
- python3-dev \
19
  && rm -rf /var/lib/apt/lists/*
20
 
21
- # Copy only the requirements first so this layer can be cached when app sources change
22
  COPY requirements.txt /app/requirements.txt
23
 
24
- # Upgrade pip tooling and install requirements
25
- RUN pip install --upgrade pip setuptools wheel && \
 
 
 
 
26
  pip install --no-cache-dir -r /app/requirements.txt
27
 
28
- # Install llama-cpp-python (build from source if wheel not available)
29
- RUN pip install --no-cache-dir llama-cpp-python
30
-
31
- # Copy app sources
32
  COPY app.py /app/app.py
33
 
34
  EXPOSE 7860 7861
35
- CMD ["python", "app.py"]
 
 
1
+ FROM python:3.11-slim
2
 
3
  ENV DEBIAN_FRONTEND=noninteractive \
 
4
  PYTHONUNBUFFERED=1
5
 
6
  WORKDIR /app
7
 
8
+ # Minimal tools to download the wheel
9
  RUN apt-get update && apt-get install -y --no-install-recommends \
10
+ ca-certificates \
11
+ curl \
 
 
 
 
 
 
12
  && rm -rf /var/lib/apt/lists/*
13
 
14
+ # Copy requirements (do NOT include llama-cpp-python here; it's installed separately)
15
  COPY requirements.txt /app/requirements.txt
16
 
17
+ # Download the prebuilt wheel and install it, then install other Python deps
18
+ RUN mkdir -p /wheels && \
19
+ curl -L -o /wheels/llama_cpp_python-0.2.75+cpubasic-cp311-cp311-linux_x86_64.whl \
20
+ "https://github.com/kuwaai/llama-cpp-python-wheels/releases/download/cpu/llama_cpp_python-0.2.75+cpubasic-cp311-cp311-linux_x86_64.whl" && \
21
+ pip install --upgrade pip setuptools wheel && \
22
+ pip install --no-cache-dir /wheels/llama_cpp_python-0.2.75+cpubasic-cp311-cp311-linux_x86_64.whl && \
23
  pip install --no-cache-dir -r /app/requirements.txt
24
 
25
+ # Copy app sources last to keep previous layers cacheable
 
 
 
26
  COPY app.py /app/app.py
27
 
28
  EXPOSE 7860 7861
29
+
30
+ CMD ["python", "app.py"]