mesh-llm/docker/Dockerfile.client
Nick DiZazzo f1953738b7
fix: keep Windows release verifier native-ABI-free (#1114)
* refactor: decouple release verifier from runtime ABI

* ci: route release footer changes through Windows
2026-07-29 16:06:23 -04:00

184 lines
9.3 KiB
Text

# mesh-llm client-only image (no GPU or bundled model)
# Supersedes fly/Dockerfile content. Supports linux/amd64 and linux/arm64.
#
# Build: DOCKER_BUILDKIT=1 docker build -f docker/Dockerfile.client -t mesh-llm:client .
# Run: docker run --rm -p 3131:3131 -p 9337:9337 -e APP_MODE=console mesh-llm:client
# docker run --rm -p 3131:3131 -p 9337:9337 -e APP_MODE=console -e MESH_HEADLESS=1 mesh-llm:client # API-only
#
# Modes (via APP_MODE env):
# console — API on 9337 + web console on 3131 (default; UI always included)
# worker — unsupported in this image; use a full-node image (:cpu/:cuda/:rocm/:vulkan)
#
# Modifiers (via env):
# MESH_HEADLESS=1 — disable web UI routes; keep /api/* and /v1/* accessible
# syntax=docker/dockerfile:1.7
FROM node:24-alpine AS ui-builder
RUN npm install -g pnpm
WORKDIR /app
COPY crates/mesh-llm-ui/package.json crates/mesh-llm-ui/pnpm-lock.yaml crates/mesh-llm-ui/pnpm-workspace.yaml ./
RUN --mount=type=cache,id=pnpm-store,target=/root/.local/share/pnpm/store \
pnpm install --frozen-lockfile
COPY crates/mesh-llm-ui/ ./
RUN pnpm run build
# Output: /app/dist
FROM debian:bookworm-slim AS rust-deps
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates curl git cmake ninja-build pkg-config libssl-dev libdbus-1-dev python3 build-essential \
&& rm -rf /var/lib/apt/lists/*
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable --profile minimal
ENV PATH="/root/.cargo/bin:$PATH"
ENV LLAMA_STAGE_BUILD_DIR=".deps/llama.cpp/build-stage-abi-static"
RUN --mount=type=cache,target=/root/.cargo/registry \
--mount=type=cache,target=/root/.cargo/git \
cargo install cargo-chef --version 0.1.68 --locked
WORKDIR /src
# Satisfy GitHub Actions preflight checks (exact strings required)
COPY Cargo.toml Cargo.lock ./
COPY crates/mesh-llm-ui/ crates/mesh-llm-ui/
COPY crates/mesh-llm-identity/ crates/mesh-llm-identity/
COPY crates/mesh-llm-native-runtime/ crates/mesh-llm-native-runtime/
COPY crates/mesh-llm-protocol/ crates/mesh-llm-protocol/
COPY crates/mesh-llm-release-footer/ crates/mesh-llm-release-footer/
COPY crates/mesh-llm-routing/ crates/mesh-llm-routing/
COPY crates/mesh-llm-guardrails/ crates/mesh-llm-guardrails/
COPY crates/mesh-llm-system/ crates/mesh-llm-system/
COPY crates/mesh-llm-gpu-bench/ crates/mesh-llm-gpu-bench/
COPY crates/mesh-llm-types/ crates/mesh-llm-types/
COPY crates/mesh-llm-config/ crates/mesh-llm-config/
COPY crates/mesh-llm-console-server/ crates/mesh-llm-console-server/
COPY crates/mesh-llm-host-runtime/Cargo.toml crates/mesh-llm-host-runtime/Cargo.toml
COPY crates/mesh-llm/Cargo.toml crates/mesh-llm/Cargo.toml
COPY crates/mesh-llm/build.rs crates/mesh-llm/build.rs
COPY crates/mesh-llm-plugin/Cargo.toml crates/mesh-llm-plugin/Cargo.toml
COPY crates/mesh-llm-plugin/build.rs crates/mesh-llm-plugin/build.rs
COPY crates/mesh-llm-skills/Cargo.toml crates/mesh-llm-skills/Cargo.toml
COPY crates/mesh-llm-plugin-manager/Cargo.toml crates/mesh-llm-plugin-manager/Cargo.toml
# Satisfy Cargo workspace member resolution
COPY crates/mesh-llm-host-runtime/ crates/mesh-llm-host-runtime/
COPY crates/mesh-llm/ crates/mesh-llm/
COPY crates/mesh-llm-plugin/ crates/mesh-llm-plugin/
COPY crates/mesh-llm-skills/ crates/mesh-llm-skills/
COPY crates/mesh-llm-plugin-manager/ crates/mesh-llm-plugin-manager/
COPY crates/mesh-client/ crates/mesh-client/
COPY crates/mesh-llm-api-client/ crates/mesh-llm-api-client/
COPY crates/mesh-llm-api-server/ crates/mesh-llm-api-server/
COPY crates/mesh-llm-node/ crates/mesh-llm-node/
COPY crates/mesh-llm-nodejs/ crates/mesh-llm-nodejs/
COPY crates/mesh-llm-ffi/ crates/mesh-llm-ffi/
COPY crates/mesh-llm-test-harness/ crates/mesh-llm-test-harness/
COPY crates/model-ref/ crates/model-ref/
COPY crates/model-artifact/ crates/model-artifact/
COPY crates/model-hf/ crates/model-hf/
COPY crates/model-package/ crates/model-package/
COPY crates/model-resolver/ crates/model-resolver/
COPY crates/skippy-protocol/ crates/skippy-protocol/
COPY crates/skippy-topology/ crates/skippy-topology/
COPY crates/skippy-cache/ crates/skippy-cache/
COPY crates/skippy-metrics/ crates/skippy-metrics/
COPY crates/openai-frontend/ crates/openai-frontend/
COPY crates/skippy-ffi/ crates/skippy-ffi/
COPY crates/skippy-runtime/ crates/skippy-runtime/
COPY crates/skippy-server/ crates/skippy-server/
COPY crates/metrics-server/ crates/metrics-server/
COPY crates/skippy-model-package/ crates/skippy-model-package/
COPY crates/skippy-coordinator/ crates/skippy-coordinator/
COPY crates/skippy-correctness/ crates/skippy-correctness/
COPY crates/llama-spec-bench/ crates/llama-spec-bench/
COPY crates/skippy-bench/ crates/skippy-bench/
COPY crates/skippy-prompt/ crates/skippy-prompt/
COPY crates/mesh-mixture-of-agents/ crates/mesh-mixture-of-agents/
COPY tools/xtask/ tools/xtask/
COPY scripts/prepare-llama.sh scripts/build-llama.sh scripts/
COPY third_party/llama.cpp/upstream.txt third_party/llama.cpp/upstream.txt
COPY third_party/llama.cpp/patches/ third_party/llama.cpp/patches/
RUN LLAMA_STAGE_USE_SCCACHE=0 scripts/prepare-llama.sh pinned && \
LLAMA_STAGE_USE_SCCACHE=0 scripts/build-llama.sh
RUN mkdir -p crates/mesh-llm-ui/dist && echo '<html></html>' > crates/mesh-llm-ui/dist/index.html
RUN cargo chef prepare --recipe-path recipe.json
RUN --mount=type=cache,target=/root/.cargo/registry \
--mount=type=cache,target=/root/.cargo/git \
--mount=type=cache,target=/src/target \
cargo chef cook --release --locked --recipe-path recipe.json
FROM rust-deps AS rust-builder
WORKDIR /src
RUN rm -rf crates/mesh-llm-ui/dist
COPY --from=ui-builder /app/dist crates/mesh-llm-ui/dist
# Restore real build scripts (cargo-chef stubs them during cook)
# Satisfy GitHub Actions preflight checks (exact strings required)
COPY Cargo.toml Cargo.lock ./
COPY crates/mesh-llm-ui/ crates/mesh-llm-ui/
COPY crates/mesh-llm-identity/ crates/mesh-llm-identity/
COPY crates/mesh-llm-native-runtime/ crates/mesh-llm-native-runtime/
COPY crates/mesh-llm-protocol/ crates/mesh-llm-protocol/
COPY crates/mesh-llm-release-footer/ crates/mesh-llm-release-footer/
COPY crates/mesh-llm-routing/ crates/mesh-llm-routing/
COPY crates/mesh-llm-guardrails/ crates/mesh-llm-guardrails/
COPY crates/mesh-llm-system/ crates/mesh-llm-system/
COPY crates/mesh-llm-gpu-bench/ crates/mesh-llm-gpu-bench/
COPY crates/mesh-llm-types/ crates/mesh-llm-types/
COPY crates/mesh-llm-config/ crates/mesh-llm-config/
COPY crates/mesh-llm-console-server/ crates/mesh-llm-console-server/
COPY crates/mesh-llm-host-runtime/Cargo.toml crates/mesh-llm-host-runtime/Cargo.toml
COPY crates/mesh-llm/Cargo.toml crates/mesh-llm/Cargo.toml
COPY crates/mesh-llm/build.rs crates/mesh-llm/build.rs
COPY crates/mesh-llm-plugin/Cargo.toml crates/mesh-llm-plugin/Cargo.toml
COPY crates/mesh-llm-plugin/build.rs crates/mesh-llm-plugin/build.rs
COPY crates/mesh-llm-skills/Cargo.toml crates/mesh-llm-skills/Cargo.toml
COPY crates/mesh-llm-plugin-manager/Cargo.toml crates/mesh-llm-plugin-manager/Cargo.toml
# Satisfy Cargo workspace member resolution
COPY crates/mesh-llm-host-runtime/ crates/mesh-llm-host-runtime/
COPY crates/mesh-llm/ crates/mesh-llm/
COPY crates/mesh-llm-plugin/ crates/mesh-llm-plugin/
COPY crates/mesh-llm-skills/ crates/mesh-llm-skills/
COPY crates/mesh-llm-plugin-manager/ crates/mesh-llm-plugin-manager/
COPY crates/mesh-client/ crates/mesh-client/
COPY crates/mesh-llm-api-client/ crates/mesh-llm-api-client/
COPY crates/mesh-llm-api-server/ crates/mesh-llm-api-server/
COPY crates/mesh-llm-node/ crates/mesh-llm-node/
COPY crates/mesh-llm-nodejs/ crates/mesh-llm-nodejs/
COPY crates/mesh-llm-ffi/ crates/mesh-llm-ffi/
COPY crates/mesh-llm-test-harness/ crates/mesh-llm-test-harness/
COPY crates/model-ref/ crates/model-ref/
COPY crates/model-artifact/ crates/model-artifact/
COPY crates/model-hf/ crates/model-hf/
COPY crates/model-package/ crates/model-package/
COPY crates/model-resolver/ crates/model-resolver/
COPY crates/skippy-protocol/ crates/skippy-protocol/
COPY crates/skippy-topology/ crates/skippy-topology/
COPY crates/skippy-cache/ crates/skippy-cache/
COPY crates/skippy-metrics/ crates/skippy-metrics/
COPY crates/openai-frontend/ crates/openai-frontend/
COPY crates/skippy-ffi/ crates/skippy-ffi/
COPY crates/skippy-runtime/ crates/skippy-runtime/
COPY crates/skippy-server/ crates/skippy-server/
COPY crates/metrics-server/ crates/metrics-server/
COPY crates/skippy-model-package/ crates/skippy-model-package/
COPY crates/skippy-coordinator/ crates/skippy-coordinator/
COPY crates/skippy-correctness/ crates/skippy-correctness/
COPY crates/llama-spec-bench/ crates/llama-spec-bench/
COPY crates/skippy-bench/ crates/skippy-bench/
COPY crates/skippy-prompt/ crates/skippy-prompt/
COPY crates/mesh-mixture-of-agents/ crates/mesh-mixture-of-agents/
COPY tools/xtask/ tools/xtask/
RUN --mount=type=cache,target=/root/.cargo/registry \
--mount=type=cache,target=/root/.cargo/git \
--mount=type=cache,target=/src/target \
cargo build --release --locked -p mesh-llm && \
mkdir -p /out && \
cp /src/target/release/mesh-llm /out/mesh-llm
FROM debian:bookworm-slim AS runtime
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates libgomp1 libdbus-1-3 \
&& rm -rf /var/lib/apt/lists/*
COPY --from=rust-builder /out/mesh-llm /usr/local/bin/mesh-llm
COPY docker/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ARG CMD=console
ENV APP_MODE=${CMD}
EXPOSE 3131 9337
ENTRYPOINT ["/entrypoint.sh"]