File size: 1,319 Bytes
9fca47f
 
81436f8
 
4e2ce7c
c1df392
4e2ce7c
c1df392
 
 
0d71f46
c1df392
 
 
b82ddfa
0d71f46
9fca47f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM python:3.10-slim

# Install curl, tar, and libgomp1 (needed by pre-built llama-server C++ binary)
RUN apt-get update && apt-get install -y curl tar libgomp1 && rm -rf /var/lib/apt/lists/*

# Download native llama-server binary and libraries from official llama.cpp releases
RUN curl -L -s https://github.com/ggml-org/llama.cpp/releases/download/b9964/llama-b9964-bin-ubuntu-x64.tar.gz -o /tmp/llama.tar.gz \
    && mkdir -p /tmp/llama-extract \
    && tar -xzf /tmp/llama.tar.gz -C /tmp/llama-extract \
    && cp /tmp/llama-extract/llama-b9964/llama-server /usr/local/bin/llama-server \
    && cp /tmp/llama-extract/llama-b9964/*.so* /usr/local/bin/ \
    && cp /tmp/llama-extract/llama-b9964/*.so* /usr/local/lib/ \
    && ldconfig \
    && rm -rf /tmp/llama.tar.gz /tmp/llama-extract


WORKDIR /code

# Copy requirements and install python packages
COPY ./requirements.txt /code/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
RUN pip install --no-cache-dir llama-cpp-python[server] --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu

# Copy the application source code
COPY . /code

# Configure execution permissions
RUN chmod +x /code/start.sh

# Expose port 7860 as required by Hugging Face Spaces
EXPOSE 7860

# Run startup script
CMD ["/code/start.sh"]