File size: 1,401 Bytes
3a8d5b6
 
 
 
 
 
 
 
 
 
 
 
 
 
a14cb58
3a8d5b6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# whatfirst-small — Gradio app + a local llama.cpp server, one container.
# Builds llama-server (multimodal) from source, then runs the Gradio UI in front
# of it. No cloud APIs at runtime.

FROM python:3.11-slim

# --- build llama.cpp (llama-server includes multimodal / mtmd support) -------
RUN apt-get update && apt-get install -y --no-install-recommends \
        build-essential cmake git libgomp1 ca-certificates \
    && rm -rf /var/lib/apt/lists/*

RUN git clone --depth 1 https://github.com/ggml-org/llama.cpp /opt/llama.cpp \
    && cmake -S /opt/llama.cpp -B /opt/llama.cpp/build \
        -DGGML_NATIVE=OFF -DLLAMA_CURL=OFF -DLLAMA_BUILD_TESTS=OFF \
    && cmake --build /opt/llama.cpp/build --config Release -j 2 --target llama-server \
    && rm -rf /opt/llama.cpp/.git

# --- non-root user (Hugging Face Spaces convention) --------------------------
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH \
    HF_HOME=/home/user/.cache/huggingface \
    MODEL_DIR=/home/user/models \
    MODEL_REPO=ggml-org/Qwen2.5-VL-3B-Instruct-GGUF \
    MODEL_FILE=Qwen2.5-VL-3B-Instruct-Q4_K_M.gguf \
    MMPROJ_FILE=mmproj-Qwen2.5-VL-3B-Instruct-f16.gguf \
    PORT=7860

WORKDIR /home/user/app
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --user -r requirements.txt
COPY --chown=user . .

EXPOSE 7860
CMD ["bash", "start.sh"]