Skip to content

fix(docker): use glibc base image so local embeddings load#97

Merged
vineethkrishnan merged 1 commit into
mainfrom
fix/local-embeddings-glibc-base
Jun 13, 2026
Merged

fix(docker): use glibc base image so local embeddings load#97
vineethkrishnan merged 1 commit into
mainfrom
fix/local-embeddings-glibc-base

Conversation

@vineethkrishnan

Copy link
Copy Markdown
Owner

Problem

With EMBEDDING_PROVIDER=local, the app crash-loops on boot. @huggingface/transformers eagerly requires the native onnxruntime-node at import time; its prebuilt binary is glibc-only and can't dlopen on Alpine/musl:

Error loading shared library ld-linux-x86-64.so.2 ... (libonnxruntime.so.1)  -> ERR_DLOPEN_FAILED
# with gcompat shim, next wall:
Error relocating libonnxruntime.so.1: __vsnprintf_chk: symbol not found

device: 'wasm' can't help because the crash happens at import, before the pipeline runs. gcompat doesn't implement the glibc fortify (*_chk) symbols.

Fix

  • Both Dockerfile stages: node:22-alpine -> node:22-slim (glibc). onnxruntime-node loads natively (and faster than WASM).
  • Adapter uses the default native backend (dropped the WASM forcing + numThreads workaround).
  • Compose healthcheck: wget (absent on slim) -> a node fetch one-liner.

Verified on the target host

App boots clean (no dlopen errors, /health/ready 200), and an in-container embed returns dim: 384. Full suite 174/174, tsc/eslint/build clean.

@huggingface/transformers eagerly requires the native onnxruntime-node at import, whose prebuilt binary is glibc-only and cannot dlopen on Alpine/musl (fails with ERR_DLOPEN_FAILED, and gcompat does not provide the glibc fortify symbols it needs). With EMBEDDING_PROVIDER=local this crashed the app on boot.

Switch both Dockerfile stages to node:22-slim (glibc), where onnxruntime-node loads natively, which is also faster than the WASM fallback. The local embedding adapter now uses the default native backend instead of forcing WASM. The compose healthcheck moves from wget (absent on slim) to a node fetch one-liner.

Verified on the target host: app boots clean and an in-container embed returns a 384-dim vector.
@vineethkrishnan vineethkrishnan merged commit d7ac07e into main Jun 13, 2026
13 checks passed
@vineethkrishnan vineethkrishnan deleted the fix/local-embeddings-glibc-base branch June 13, 2026 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant