Skip to content

Commit 7a8f539

Browse files
jkyberneeesclaude
andcommitted
fix(docker): bundle llama-mtmd-cli shared libraries and register with ldconfig
The pre-built Ubuntu llama.cpp binaries are dynamically linked against libllama.so, libmtmd.so, etc. shipped in the same release tarball. We were extracting only the CLI binary, leaving the shared libs behind, which caused "missing shared library" failures at runtime. Fix: also extract all *.so* files into /usr/local/lib/llama/ in the minicpm stage, COPY them into the runtime image, and register them via ldconfig. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 33ec4a8 commit 7a8f539

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

docker/Dockerfile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
7171
curl ca-certificates \
7272
&& rm -rf /var/lib/apt/lists/*
7373
# Map dpkg architecture to the llama.cpp release asset name suffix
74-
# (amd64 → x64, arm64 → arm64) and extract only llama-mtmd-cli.
74+
# (amd64 → x64, arm64 → arm64). Extract the CLI binary and all bundled
75+
# shared libraries (.so*) — the pre-built Ubuntu binaries are dynamically
76+
# linked against libllama.so, libmtmd.so, etc. shipped in the same tarball.
7577
RUN set -ex \
7678
&& LLAMA_ARCH=$(dpkg --print-architecture | sed 's/amd64/x64/') \
7779
&& curl -fsSL \
@@ -80,6 +82,8 @@ RUN set -ex \
8082
&& mkdir -p /tmp/llama-bin \
8183
&& tar -xzf /tmp/llama.tar.gz -C /tmp/llama-bin \
8284
&& find /tmp/llama-bin -name "llama-mtmd-cli" -exec install -m 755 {} /usr/local/bin/llama-mtmd-cli \; \
85+
&& mkdir -p /usr/local/lib/llama \
86+
&& find /tmp/llama-bin -name "*.so*" -exec cp -P {} /usr/local/lib/llama/ \; \
8387
&& rm -rf /tmp/llama.tar.gz /tmp/llama-bin
8488
# Fetch the model GGUF and vision projector into a fixed image path (NOT under
8589
# ~/.odek — bind-mount profiles would hide files baked there). The runtime
@@ -122,8 +126,12 @@ COPY --from=whisper /models/ /usr/local/share/whisper/models/
122126

123127
# Bundle llama-mtmd-cli + MiniCPM-V 4.6 from the minicpm stage so `vision`
124128
# works with zero setup. The tool auto-detects /usr/local/share/minicpm-v/models.
129+
# The shared libraries (libllama.so, libmtmd.so, …) are registered via ldconfig
130+
# so the dynamically-linked binary resolves them at runtime.
125131
COPY --from=minicpm /usr/local/bin/llama-mtmd-cli /usr/local/bin/llama-mtmd-cli
132+
COPY --from=minicpm /usr/local/lib/llama/ /usr/local/lib/llama/
126133
COPY --from=minicpm /usr/local/share/minicpm-v/models/ /usr/local/share/minicpm-v/models/
134+
RUN echo "/usr/local/lib/llama" > /etc/ld.so.conf.d/llama.conf && ldconfig
127135

128136
# ── Adding extra dependencies the agent can use ──────────────────────────
129137
# The agent runs shell commands INSIDE this image, so any runtime or CLI it

0 commit comments

Comments
 (0)