File size: 1,155 Bytes
4a86e79
c16c3a7
4a86e79
 
 
c16c3a7
 
 
4a86e79
 
 
 
 
 
 
 
fa34d32
c16c3a7
4a86e79
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59fd9c4
23d57e6
4a86e79
 
 
c16c3a7
 
4a86e79
 
c16c3a7
 
 
 
4a86e79
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
FROM python:3.12-slim

ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
ENV PIP_NO_CACHE_DIR=1

WORKDIR /app

RUN apt-get update && apt-get install -y --no-install-recommends \
    git \
    cmake \
    build-essential \
    curl \
    ca-certificates \
    libgomp1 \
    && rm -rf /var/lib/apt/lists/*


# Build llama.cpp for CPU.
RUN git clone --depth 1 https://github.com/ggml-org/llama.cpp.git /tmp/llama.cpp \
    && cmake -S /tmp/llama.cpp -B /tmp/llama.cpp/build \
        -DGGML_NATIVE=OFF \
        -DGGML_OPENMP=ON \
        -DLLAMA_BUILD_SERVER=ON \
        -DLLAMA_BUILD_TESTS=OFF \
        -DLLAMA_BUILD_EXAMPLES=ON \
    && cmake --build /tmp/llama.cpp/build \
        --config Release \
        --target llama-server \
        -j2 \
    && mkdir -p /opt/llama \
    && cp /tmp/llama.cpp/build/bin/llama-server /opt/llama/llama-server \
    && cp /tmp/llama.cpp/build/bin/*.so* /opt/llama/ 2>/dev/null || true \
    && rm -rf /tmp/llama.cpp


# Hugging Face downloader.
RUN pip install --upgrade pip \
    && pip install huggingface_hub


COPY start.sh /app/start.sh
RUN chmod +x /app/start.sh


EXPOSE 7860


CMD ["/app/start.sh"]