mirror of
https://github.com/mudler/LocalAI.git
synced 2026-06-11 10:19:33 -04:00
Python's tier-1+2 base image (apt + GPU SDK + lang toolchain) was the only
lang previously factored. The remaining 82 matrix entries (62 golang +
9 llama-cpp + 9 turboquant + 1 ik-llama-cpp + 1 rust) still inlined the
same bootstrap into per-backend cache tags.
Add .docker/bases/Dockerfile.{golang,cpp,rust} mirroring Dockerfile.python's
GPU stack, with the lang-specific tail at the bottom (Go + protoc + grpc
tooling; protoc + cmake + GRPC; rustup + audio dev libs respectively).
Slim the five consumer Dockerfiles to FROM ${BASE_IMAGE_PREBUILT} + the
per-backend COPY/make.
The C++ trio (llama-cpp, ik-llama-cpp, turboquant) only differ in their
make targets, so langOf() in scripts/changed-backends.js remaps all three
Dockerfile suffixes to the shared 'cpp' base. That collapses 17 would-be
distinct bases to 8. langTriggerSelector and baseTriggerFiles are
extended so PRs touching the new recipes fan out canaries; the
.docker/bases/ auto-detection picks up the new langs without further
script changes.
Makefile: add docker-build-{python,golang,cpp,rust}-base targets and a
local-base-tag/local-base-target macro pair so each backend's
docker-build-X chains through the right base. The previous python-only
prereq is now a generic per-lang dispatch.
Total distinct bases for the full 234-entry matrix: 29 (was 9 with only
python factored). The C++ base also absorbs the previously per-consumer
GRPC build stage, removing the dominant cost from the llama-cpp /
ik-llama-cpp / turboquant rebuild paths.
Assisted-by: Claude:opus-4-7-1m [Claude Code]
Signed-off-by: Richard Palethorpe <io@richiejp.com>
24 lines
690 B
Docker
24 lines
690 B
Docker
# Builds a single Rust backend on top of the shared
|
|
# .docker/bases/Dockerfile.rust base. The base bakes in apt + Rust +
|
|
# protobuf-compiler + audio dev libs (espeak/sonic/pcaudio/opus), so this
|
|
# stage only carries the per-backend COPY + `make build`.
|
|
#
|
|
# CI orchestration (.github/workflows/backend.yml + backend_pr.yml) passes
|
|
# BASE_IMAGE_PREBUILT. See .agents/ci-caching.md.
|
|
|
|
ARG BASE_IMAGE_PREBUILT
|
|
|
|
FROM ${BASE_IMAGE_PREBUILT} AS builder
|
|
ARG BACKEND=kokoros
|
|
|
|
COPY . /LocalAI
|
|
|
|
RUN git config --global --add safe.directory /LocalAI
|
|
|
|
RUN make -C /LocalAI/backend/rust/${BACKEND} build
|
|
|
|
FROM scratch
|
|
ARG BACKEND=kokoros
|
|
|
|
COPY --from=builder /LocalAI/backend/rust/${BACKEND}/package/. ./
|