Rebase to Alpine 3.24, use distro onnxruntime for the discovery embedding runtime#36
Merged
thelamer merged 1 commit intoJul 12, 2026
Conversation
thelamer
approved these changes
Jul 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
Closes #35.
gcompatandonnxruntimeto the runtime packages.npm install, replace the bundled glibclibonnxruntime.so.1insideonnxruntime-nodewith a symlink to the distro's musl build, and remove the bundled CUDA/TensorRT provider libraries (~316 MB) that CPU inference never loads.Benefits of this PR and context:
mStream ≥6.16 ships a discovery/recommendation engine whose embedding model runs on
onnxruntime-node. That npm package bundles glibc-only binaries, so on this image the worker dies at import (Error loading shared library ld-linux-x86-64.so.2) and the feature can never build its data (#35).gcompatalone is not enough — the bundled runtime references fortified glibc symbols (__vsnprintf_chk,__memcpy_chk, …) that the shim doesn't implement. But Alpine 3.24's community repo now packages a native musl onnxruntime 1.24.4, the same 1.24 line the npm binding targets. With the distro runtime symlinked in, the only glibc code left is the npm package's thin 384 KB N-API binding, which gcompat handles fine.Net effect: the recommendation features work, and the image shrinks by ~350 MB (the deleted CUDA/TensorRT libs outweigh the added packages).
The
if [ -d … ]guard keeps the build working even if a future mStream release drops the optionalonnxruntime-nodedependency. If mStream ever moves to a newer onnxruntime line before Alpine does, mStream detects the failed load (as of IrosTheBeggar/mStream#718, in the next release), logs one clear error, and disables the embedding pass — the image itself is never broken by drift.How Has This Been Tested?
collectDiscoveryDataenabled against a small music library: the embedding pass completed real inferences —Discovery-embedding pass complete: 6 embedded, 0 error(s)— and the discovery DB contains 1280-d embeddings + genre predictions.alpine:3.24container with the real model (18 MB EffNet ONNX): full inference passes with the system runtime + gcompat; fails without.onnxruntimeapk exists for aarch64 at 3.24 as well (onnxruntime-1.24.4-r1via qemu); the arm64 image itself was not run here and deserves a smoke in your CI.Source / References: