Dockerfile: build from source and install every engine beside the front end

The source build runs on hosts without a CUDA toolkit (kontron, kompute),
but it installed only unbiased-strata. The front end resolves a bare
--engine name beside its own binary, so the container fell back to strata
and died with 'unknown argument: strata-poly' in a restart loop. Copy all
four binaries plus libstrata_kq.so into one directory.

Also bump third_party/llama.cpp to 44072a19f: DeepSeek V4.1 chat template
and DSML parsing, the qwen3-coder tool-call parser fixes (stray close tags,
blank lines, stuttered closes, any argument order) and the shrinking
partial parse.
This commit is contained in:
lotherk committed 2026-11-17 17:39:10 +00:00
1 parent 3de4779696
commit 7813dc8b53
2 files changed
+35 -20

No files matched your search

+34 -19
View File
@@ -2,10 +2,12 @@
#
# UnbiasedStrata on a Pascal card (Tesla P40 / GTX 10-series, sm_61).
#
# The engine and the C++ front end are compiled during docker build into one
# binary, unbiased-strata, which serves the OpenAI-style API. Nothing is
# downloaded at build or run time: the model shards, the pack and the draft
# (MTP) head must be mounted. See README.md.
# The engines (strata, strata-poly, strata-dsv41) and the C++ front end are
# compiled during docker build. The front end serves the OpenAI-style API and
# starts the engine named by --engine as a child process; a bare engine name is
# looked up BESIDE the front end binary, so all of them must sit in the same
# directory. Nothing is downloaded at build or run time: the model shards, the
# pack and the draft (MTP) head must be mounted. See README.md.
#
# Build:
# docker build -t unbiased-strata:p40 .
@@ -13,18 +15,32 @@
# Run (host needs an NVIDIA driver and nvidia-container-toolkit):
# docker run --rm --gpus '"device=2"' -p 8082:8080 \
# -v /path/models:/models:ro -v /path/Strata-data:/strata:ro \
# unbiased-strata:p40 --model /models/...-00001-of-00002.gguf \
# --pack /strata/pack-iq3-xxs --mtp /strata/mtp \
# --ctx 32768 --host 0.0.0.0 --port 8080
# unbiased-strata:p40 --engine strata-poly -m /models/model.gguf \
# --host 0.0.0.0 --port 8080 -- --ctx 32768
#
# PASCAL=1 compiles sm_61 and turns on the engine's STRATA_EXPERIMENTAL_SM60
# path. It needs a CUDA 12.x toolkit (CUDA 13 dropped sm_60/sm_70); 12.8.1 is
# the last 12.x release and still supports Pascal. Override CUDA_ARCHS to build
# for another card, e.g. --build-arg CUDA_ARCHS=86 for an RTX 30.
# Pre-built binaries are copied from the host build tree.
# The Dockerfile does NOT compile from source — strata_kq has known
# compilation issues in the containerized build environment.
FROM nvidia/cuda:12.8.1-devel-ubuntu24.04 AS build
ARG CUDA_ARCHS=61
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential cmake git ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /src
COPY . .
# third_party/llama.cpp is the pinned submodule; the Makefile applies
# patches/llama.cpp-qwen3-coder-any-argument-order.patch if it is not already.
# Its .git pointer names a path outside the context, so drop it: git apply then
# runs in no-repository mode, which is all the patch step needs.
RUN rm -rf third_party/llama.cpp/.git \
&& make build PASCAL=1 CUDA_ARCHS="${CUDA_ARCHS}"
FROM nvidia/cuda:12.8.1-runtime-ubuntu24.04
@@ -33,15 +49,14 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates curl \
&& rm -rf /var/lib/apt/lists/*
# The C++ frontend server binary (OpenAI-style API).
COPY build/bin/unbiased-strata /usr/local/bin/unbiased-strata
# The strata engine binary (GSQ-RCO pack/MTP models like Qwen3.8).
COPY build/bin/strata /usr/local/bin/strata
# The strata-poly engine binary (standard GGUF models like Qwen3.6).
COPY build/bin/strata-poly /usr/local/bin/strata-poly
# The shared library for KQ computation.
COPY build/bin/libstrata_kq.so /usr/local/lib/libstrata_kq.so
RUN ldconfig
# All binaries land in ONE directory: the front end resolves a bare --engine
# name relative to its own path (/proc/self/exe), and the engines link
# libstrata_kq.so from their rpath, so the library sits beside them too.
COPY --from=build /src/build/bin/unbiased-strata /usr/local/bin/unbiased-strata
COPY --from=build /src/build/bin/strata /usr/local/bin/strata
COPY --from=build /src/build/bin/strata-poly /usr/local/bin/strata-poly
COPY --from=build /src/build/bin/strata-dsv41 /usr/local/bin/strata-dsv41
COPY --from=build /src/build/bin/libstrata_kq.so /usr/local/bin/libstrata_kq.so
EXPOSE 8080