mirror of
https://github.com/mudler/LocalAI.git
synced 2026-06-26 17:37:07 -04:00
fix(backends): ship the package/ dir for darwin go backend images (#10522)
fix(backends): ship the package/ dir for darwin go backends golang-darwin.sh packaged the whole backend source/build dir as the OCI image (backend/go/$BACKEND/.), so the runtime dylibs ended up under package/lib and backend-assets/lib while run.sh looks in $CURDIR/lib. As a result a backend like sherpa-onnx could not dlopen its libsherpa-shim.dylib at runtime and exited immediately (the model then 500s with "grpc service not ready"); it started fine only when run from inside package/. Ship package/. instead — the self-contained run.sh + binary + lib/ bundle — matching the Linux Dockerfile.golang (`COPY .../package/. ./`). Backends that don't assemble a package/ fall back to the backend dir, and the binary-existence guard now checks the directory actually shipped. Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Ettore Di Giacinto <mudler@localai.io> Co-authored-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
@@ -22,8 +22,20 @@ if [ -f "${BACKEND_DIR}/run.sh" ]; then
|
||||
RUN_BINARY=$(grep -oE '\$CURDIR/[A-Za-z0-9._-]+' "${BACKEND_DIR}/run.sh" | grep -v 'ld\.so' | tail -1 | sed 's|\$CURDIR/||')
|
||||
fi
|
||||
RUN_BINARY="${RUN_BINARY:-${BACKEND}}"
|
||||
if [ ! -x "${BACKEND_DIR}/${RUN_BINARY}" ]; then
|
||||
echo "ERROR: ${BACKEND_DIR}/${RUN_BINARY} not found after build; refusing to package a broken backend image (see issue #10267)." >&2
|
||||
|
||||
# Ship the self-contained package/ dir (run.sh + binary + lib/), matching the
|
||||
# Linux Dockerfile.golang (`COPY .../package/. ./`). Packaging the whole backend
|
||||
# dir instead left the runtime libraries under package/lib while run.sh looks in
|
||||
# $CURDIR/lib, so backends such as sherpa-onnx could not dlopen their libs at
|
||||
# runtime (they started fine only when run from inside package/). Backends that
|
||||
# don't assemble a package/ fall back to the backend dir.
|
||||
OCI_ROOT="${BACKEND_DIR}"
|
||||
if [ -d "${BACKEND_DIR}/package" ]; then
|
||||
OCI_ROOT="${BACKEND_DIR}/package"
|
||||
fi
|
||||
|
||||
if [ ! -x "${OCI_ROOT}/${RUN_BINARY}" ]; then
|
||||
echo "ERROR: ${OCI_ROOT}/${RUN_BINARY} not found after build; refusing to package a broken backend image (see issue #10267)." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -31,7 +43,7 @@ PLATFORMARCH="${PLATFORMARCH:-darwin/arm64}"
|
||||
IMAGE_NAME="${IMAGE_NAME:-localai/${BACKEND}-darwin}"
|
||||
|
||||
./local-ai util create-oci-image \
|
||||
backend/go/${BACKEND}/. \
|
||||
"${OCI_ROOT}/." \
|
||||
--output ./backend-images/${BACKEND}.tar \
|
||||
--image-name $IMAGE_NAME \
|
||||
--platform $PLATFORMARCH
|
||||
|
||||
Reference in New Issue
Block a user