File size: 1,332 Bytes
106db30
8a4f00d
106db30
 
 
 
 
 
 
 
8fd0c06
106db30
4ec3328
 
106db30
8fd0c06
 
 
e8482a8
4ec3328
 
2a6826a
0dc41c6
2a6826a
 
8fd0c06
106db30
 
6dfac1c
106db30
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e8482a8
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
# Grab a fresh copy of the Python image
FROM python:3.11-slim

# Install build and runtime dependencies
RUN apt-get update && \
    apt-get install -y \
    libopenblas-dev \
    ninja-build \
    build-essential \
    pkg-config \
    curl cmake git

# RUN pip install -U pip setuptools wheel && \
#     CMAKE_ARGS="-DLLAMA_BLAS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS" FORCE_CMAKE=1 pip install --verbose llama-cpp-python[server]


RUN git clone https://github.com/ggerganov/llama.cpp.git llamacpp --depth 1 && \
    cd llamacpp && \
    sed -i 's/v1\/chat/api\/v1\/chat/g' examples/server/server.cpp && \
    cmake -B build -DLLAMA_BLAS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS && \
    cmake --build build --config Release --target main server && \
    cp build/bin/* ../ && \
    touch /llama.log && \
    chmod 777 /llama.log && \
    ls -lt 

# Download model
RUN mkdir model && \
    curl -L https://huggingface.co/TheBloke/openchat-3.5-0106-GGUF/resolve/main/openchat-3.5-0106.Q4_K_M.gguf -o model/gguf-model.bin

COPY ./start_server.sh ./
COPY ./main.py ./
COPY ./index.html ./

# Make the server start script executable
RUN chmod +x ./start_server.sh

# Set environment variable for the host
ENV HOST=0.0.0.0
ENV PORT=7860

# Expose a port for the server
EXPOSE ${PORT}

# Run the server start script
CMD ["/bin/sh", "./start_server.sh"]