fix: use rice when embedding large binaries (#5309)

* fix(embed): use go-rice for large backend assets

Golang embed FS has a hard limit that we might exceed when providing
many binary alternatives.

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

* simplify golang deps

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

* chore(tests): switch to testcontainers and print logs

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

* fix(tests): do not build a test binary

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

* small fixup

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

---------

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
Ettore Di Giacinto 2025-05-04 16:42:42 +02:00 committed by GitHub
parent 7ebd7b2454
commit 21bdfe5fa4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 180 additions and 122 deletions

View file

@ -2,11 +2,11 @@ package config
import (
"context"
"embed"
"encoding/json"
"regexp"
"time"
rice "github.com/GeertJohan/go.rice"
"github.com/mudler/LocalAI/pkg/xsysinfo"
"github.com/rs/zerolog/log"
)
@ -47,7 +47,7 @@ type ApplicationConfig struct {
Galleries []Gallery
BackendAssets embed.FS
BackendAssets *rice.Box
AssetsDestination string
ExternalGRPCBackends map[string]string
@ -198,7 +198,7 @@ func WithBackendAssetsOutput(out string) AppOption {
}
}
func WithBackendAssets(f embed.FS) AppOption {
func WithBackendAssets(f *rice.Box) AppOption {
return func(o *ApplicationConfig) {
o.BackendAssets = f
}