From 70a83104292c4e1fe5f43dd5f50e5214928c8dd6 Mon Sep 17 00:00:00 2001 From: soryu Date: Sat, 2 May 2026 15:26:39 +0100 Subject: build(server): split Dockerfiles, make ML model paths optional (#120) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Existing Dockerfile (with LLM/STT/TTS model download) is now `Dockerfile.full`. The new top-level `Dockerfile` builds a slim image without python, without huggingface_hub, without the model download step. The slim image is the new default for users who only want the orchestration surface — the directive folder UI, the mesh/task system, the API. ## Slim Dockerfile * No python / huggingface_hub / model downloads. * Same runtime tooling as `k8s/daemon/Dockerfile` (git, gh CLI, ssh, jq, curl, ca-certs, libssl3). * Embeds the daemon binary at /app/daemon-binaries/makima-linux-x86_64 for the in-server download endpoint. * PARAKEET_MODEL_DIR / SORTFORMER_MODEL_PATH / CHATTERBOX_MODEL_DIR are intentionally NOT set — Listen and Speak return "ML models not configured" if a client tries to use them. ## ML model paths now optional `ServerArgs.parakeet_model_dir`, `parakeet_eou_dir`, `sortformer_model_path`, `chatterbox_model_dir` are now `Option` (no defaults). The bin constructor inspects them: if all four are present, configures `AppState::new`; if all four are absent, uses the new `AppState::new_slim()` which leaves `model_config = None`. The lazy load path in `get_ml_models` already returned a clean error for None. Speak (TTS) was already optional via `model_config.as_ref()` — still works. Mixed configurations log a warning and degrade to slim mode. ## Ops note The old `Dockerfile.full` retains the original behaviour for anyone who needs STT/diarization/TTS in production. CI still builds the daemon image from `k8s/daemon/Dockerfile` (untouched). Co-authored-by: Claude Opus 4.7 (1M context) --- makima/src/bin/makima.rs | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) (limited to 'makima/src/bin/makima.rs') diff --git a/makima/src/bin/makima.rs b/makima/src/bin/makima.rs index 338d8f9..a84c581 100644 --- a/makima/src/bin/makima.rs +++ b/makima/src/bin/makima.rs @@ -42,13 +42,33 @@ async fn run_server( eprintln!("=== Makima Server Starting ==="); eprintln!("Port: {}", args.port); - // Create app state - let mut app_state = makima::server::state::AppState::new( - &args.parakeet_model_dir, - &args.parakeet_eou_dir, - &args.sortformer_model_path, - &args.chatterbox_model_dir, - ); + // Create app state. ML model paths are optional now — when none of + // them are supplied (the slim Dockerfile case) Listen and Speak + // websocket endpoints respond with "not configured" and everything + // else works normally. + let mut app_state = match ( + args.parakeet_model_dir.as_deref(), + args.parakeet_eou_dir.as_deref(), + args.sortformer_model_path.as_deref(), + args.chatterbox_model_dir.as_deref(), + ) { + (Some(p), Some(eou), Some(sf), Some(cb)) => { + eprintln!("ML models configured (lazy load on first use)"); + makima::server::state::AppState::new(p, eou, sf, cb) + } + (None, None, None, None) => { + eprintln!("ML models NOT configured — Listen/Speak disabled"); + makima::server::state::AppState::new_slim() + } + _ => { + eprintln!( + "WARNING: only some ML model paths provided. Pass all four \ + (parakeet/parakeet_eou/sortformer/chatterbox) to enable ML, \ + or none to run in slim mode. Continuing in slim mode." + ); + makima::server::state::AppState::new_slim() + } + }; // Connect to database if URL provided if let Some(ref db_url) = args.database_url { -- cgit v1.2.3