ishka2009 commited on
Commit
7265de1
·
verified ·
1 Parent(s): 69e569a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +22 -10
Dockerfile CHANGED
@@ -1,23 +1,35 @@
1
  FROM python:3.11
2
 
 
 
 
 
3
  WORKDIR /app
4
 
5
- # Essentials for building llama-cpp-python
6
- RUN apt-get update && apt-get install -y \
7
  build-essential \
8
  cmake \
 
 
 
 
 
9
  python3-dev \
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
- # Copy and install Python dependencies
13
- COPY requirements.txt .
14
- RUN pip install -r requirements.txt
 
 
 
15
 
16
- # Build llama-cpp-python from source (CPU-only)
17
- RUN pip install llama-cpp-python
18
 
19
- # Copy application file
20
- COPY app.py .
21
 
22
  EXPOSE 7860 7861
23
- CMD ["python", "app.py"]
 
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"]