MiniCPM5-1B-Agent / Dockerfile
Nekochu's picture
point refs to final public homes + drop placeholder (#1)
a399cf8
Raw
History Blame Contribute Delete
2.37 kB
# MiniCPM5-1B-Agent demo Space - llama.cpp server (Q8_0 GGUF) + the agent-loop UI (app.py).
# Based on the proven usermma/MiniCPM-5-Q4 pattern (FROM ghcr.io/ggml-org/llama.cpp:full), but instead
# of the raw chat UI we run app.py, which starts llama-server itself and drives the write->run->verify loop.
FROM ghcr.io/ggml-org/llama.cpp:full
WORKDIR /app
# Python venv for the app deps (keep separate from the image's own python usage).
RUN apt-get update && apt-get install -y --no-install-recommends python3-pip python3-venv \
&& rm -rf /var/lib/apt/lists/*
RUN python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
COPY requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir -U pip && pip install --no-cache-dir -r /app/requirements.txt
# The :full image ships the standalone binaries under /app (entrypoint is /app/tools.sh dispatcher).
# Make `llama-server` resolvable on PATH for agent.py (CODEAGENT_LLAMA_BIN). Prefer the known
# /app/llama-server; fall back to a search. Fail the build loudly if neither resolves.
RUN if [ -x /app/llama-server ]; then ln -sf /app/llama-server /usr/local/bin/llama-server; \
else ln -sf "$(find / -name llama-server -type f 2>/dev/null | head -1)" /usr/local/bin/llama-server; fi \
&& llama-server --version 2>&1 | head -1
# The GGUF is pulled at RUNTIME by app.py from the (now public) model repo - HF_TOKEN optional
# (MODEL_REPO/MODEL_FILE below) - not baked into the image, so the private model never lives in the layers.
# App code + bundled backend / schema. The tokenizer is NOT bundled - app.py pulls it at runtime from the
# model repo (MODEL_REPO/tokenizer) so the tokenizer lives in exactly one place (the GGUF repo, with the model).
COPY app.py /app/app.py
COPY backend /app/backend
COPY data /app/data
ENV CODEAGENT_PROJ=/app \
CODEAGENT_LLAMA_BIN=llama-server \
CODEAGENT_GGUF=/app/model.gguf \
CODEAGENT_CTX=131072 \
CODEAGENT_THREADS=2 \
CODEAGENT_MAX_ITERS=20 \
CODEAGENT_BASH_TIMEOUT=150 \
MODEL_REPO=Luminia/MiniCPM5-1B-Agent-GGUF \
MODEL_FILE=MiniCPM5-1B-Agent-v4-Q8_0.gguf \
HF_HOME=/app/.hf
# HF_TOKEN optional now the model repo is public (kept for back-compat; popped after download).
# Override the llama.cpp image's entrypoint - we launch the Python app, which spawns llama-server itself.
ENTRYPOINT []
CMD ["python3", "/app/app.py"]