fugthchat commited on
Commit
d67838f
·
1 Parent(s): 4676f49

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +31 -3
Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- FROM python:3.10-slim
2
 
3
  ENV PYTHONDONTWRITEBYTECODE=1 \
4
  PYTHONUNBUFFERED=1 \
@@ -7,16 +7,44 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
7
 
8
  WORKDIR /app
9
 
10
- # Runtime deps (libgomp helps llama-cpp wheels / OpenMP)
11
  RUN apt-get update \
12
- ; apt-get install -y --no-install-recommends libgomp1 ca-certificates \
 
 
 
 
 
 
 
13
  ; rm -rf /var/lib/apt/lists/*
14
 
15
  # Install deps first (better layer caching)
16
  COPY requirements.txt ./
 
 
 
 
17
  RUN pip install --upgrade pip \
18
  ; pip install -r requirements.txt
19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  # Copy app and model files
21
  COPY app.py ./
22
  COPY *.gguf ./
 
1
+ FROM python:3.10-slim AS builder
2
 
3
  ENV PYTHONDONTWRITEBYTECODE=1 \
4
  PYTHONUNBUFFERED=1 \
 
7
 
8
  WORKDIR /app
9
 
10
+ # Build deps: required to compile llama-cpp-python from source on HF
11
  RUN apt-get update \
12
+ ; apt-get install -y --no-install-recommends \
13
+ build-essential \
14
+ gcc \
15
+ g++ \
16
+ cmake \
17
+ git \
18
+ libgomp1 \
19
+ ca-certificates \
20
  ; rm -rf /var/lib/apt/lists/*
21
 
22
  # Install deps first (better layer caching)
23
  COPY requirements.txt ./
24
+
25
+ # Optional: keep build simple and CPU-friendly
26
+ ENV CMAKE_ARGS="-DLLAMA_BLAS=OFF"
27
+
28
  RUN pip install --upgrade pip \
29
  ; pip install -r requirements.txt
30
 
31
+
32
+ FROM python:3.10-slim AS runtime
33
+
34
+ ENV PYTHONDONTWRITEBYTECODE=1 \
35
+ PYTHONUNBUFFERED=1 \
36
+ PORT=7860
37
+
38
+ WORKDIR /app
39
+
40
+ # Runtime deps (OpenMP)
41
+ RUN apt-get update \
42
+ ; apt-get install -y --no-install-recommends libgomp1 ca-certificates \
43
+ ; rm -rf /var/lib/apt/lists/*
44
+
45
+ # Copy installed python packages from builder
46
+ COPY --from=builder /usr/local /usr/local
47
+
48
  # Copy app and model files
49
  COPY app.py ./
50
  COPY *.gguf ./