switching back to AIO build of localai

This commit is contained in:
crowetic 2025-05-19 19:16:39 -07:00
parent dffcd2d318
commit 9cf8d1b07c

View File

@ -69,69 +69,30 @@ if [[ "$1" == "--update" ]]; then
echo "🔧 Running make prepare..." echo "🔧 Running make prepare..."
make prepare make prepare
echo "🧠 Building LocalAI binary with GPU, localrecall, and localagi..." # echo "🧠 Building LocalAI binary with GPU, localrecall, and localagi..."
make build \ # make build \
TAGS="localrecall,localagi,gpu" \ # TAGS="localrecall,localagi,gpu" \
BACKENDS="llama-cuda whispercpp stablediffusion ollama" \ # BACKENDS="llama-cuda whispercpp stablediffusion ollama" \
GPU_SUPPORT="cuda" # GPU_SUPPORT="cuda"
# Download your custom Dockerfile # # Download your custom Dockerfile
echo "📥 Downloading custom Dockerfile..." # echo "📥 Downloading custom Dockerfile..."
curl -fsSL "$DOCKERFILE_URL" -o Dockerfile # curl -fsSL "$DOCKERFILE_URL" -o Dockerfile
# Build the container # # Build the container
echo "🔨 Building custom LocalAI Docker image..." # echo "🔨 Building custom LocalAI Docker image..."
docker build -t localai:custom . # docker build -t localai:custom .
# Remove existing container # # Remove existing container
docker stop localai 2>/dev/null || true # docker stop localai 2>/dev/null || true
docker rm localai 2>/dev/null || true # docker rm localai 2>/dev/null || true
# Create model and config directories if needed # # Create model and config directories if needed
mkdir -p ~/ai-stack/localai/models # mkdir -p ~/ai-stack/localai/models
mkdir -p ~/ai-stack/localai/config # mkdir -p ~/ai-stack/localai/config
# Run new container
docker run -d \
--name localai \
--gpus all \
-p 8080:8080 \
-v ~/ai-stack/localai/models:/models \
-v ~/ai-stack/localai/config:/config \
-e ENABLE_BACKENDS=llama-cuda,ollama \
-e INCLUDE_DEFAULT_MODELS=true \
-e AUTOLOAD_MODELS=true \
-e MODEL_PATH=/models \
--restart unless-stopped \
localai:custom
echo "✅ LocalAI (custom) is now running at http://localhost:8080"
# # 🔁 Updating LocalAI (GPU build)
# if check_container_running "localai"; then
# echo "🧠 Updating LocalAI..."
# docker stop localai
# docker rm localai
# else
# echo " Installing LocalAI..."
# fi
# docker pull localai/localai:latest-aio-gpu-nvidia-cuda-12
# # Ensure default models.yaml exists
# MODELS_YAML=~/ai-stack/localai/config/models.yaml
# if [ ! -f "$MODELS_YAML" ]; then
# echo "📄 Creating default models.yaml..."
# cat > "$MODELS_YAML" <<EOF
# - name: phi
# backend: llama-cuda
# parameters:
# model: /models/phi-2.gguf
# EOF
# fi
# # Run new container
# docker run -d \ # docker run -d \
# --name localai \ # --name localai \
# --gpus all \ # --gpus all \
@ -143,9 +104,36 @@ if [[ "$1" == "--update" ]]; then
# -e AUTOLOAD_MODELS=true \ # -e AUTOLOAD_MODELS=true \
# -e MODEL_PATH=/models \ # -e MODEL_PATH=/models \
# --restart unless-stopped \ # --restart unless-stopped \
# localai/localai:latest-aio-gpu-nvidia-cuda-12 # localai:custom
# echo "✅ LocalAI running at http://localhost:8080" # echo "✅ LocalAI (custom) is now running at http://localhost:8080"
# 🔁 Updating LocalAI (GPU build)
if check_container_running "localai"; then
echo "🧠 Updating LocalAI..."
docker stop localai
docker rm localai
else
echo " Installing LocalAI..."
fi
docker pull localai/localai:latest-aio-gpu-nvidia-cuda-12
docker run -d \
--name localai \
--gpus all \
-p 8080:8080 \
-v ~/ai-stack/localai/models:/models \
-v ~/ai-stack/localai/config:/config \
-e ENABLE_BACKENDS=llama-cuda,ollama \
-e INCLUDE_DEFAULT_MODELS=true \
-e AUTOLOAD_MODELS=true \
-e MODEL_PATH=/models \
--restart unless-stopped \
localai/localai:latest-aio-gpu-nvidia-cuda-12
echo "✅ LocalAI running at http://localhost:8080"
@ -481,18 +469,18 @@ EOF
fi fi
fi fi
# if [[ "$1" != "--update" ]]; then if [[ "$1" != "--update" ]]; then
# if check_container_running "localai"; then if check_container_running "localai"; then
# echo "✅ Skipping LocalAI install (already running)." echo "✅ Skipping LocalAI install (already running)."
# else else
# read -p " Install LocalAI (GPU-accelerated)? [y/N]: " localai_prompt read -p " Install LocalAI (GPU-accelerated)? [y/N]: " localai_prompt
# if [[ "$localai_prompt" =~ ^[Yy]$ ]]; then if [[ "$localai_prompt" =~ ^[Yy]$ ]]; then
# echo "🧠 Installing LocalAI (NVIDIA CUDA 12)..." echo "🧠 Installing LocalAI (NVIDIA CUDA 12)..."
# mkdir -p ~/ai-stack/localai/models mkdir -p ~/ai-stack/localai/models
# mkdir -p ~/ai-stack/localai/config mkdir -p ~/ai-stack/localai/config
# echo "📄 Creating default models.yaml..." echo "📄 Creating default models.yaml..."
# cat > ~/ai-stack/localai/config/models.yaml <<EOF # cat > ~/ai-stack/localai/config/models.yaml <<EOF
# - name: phi # - name: phi
# backend: llama-cuda # backend: llama-cuda
@ -500,59 +488,59 @@ fi
# model: /models/phi-2.gguf # model: /models/phi-2.gguf
# EOF # EOF
# docker pull localai/localai:latest-aio-gpu-nvidia-cuda-12 docker pull localai/localai:latest-aio-gpu-nvidia-cuda-12
# docker run -d \
# --name localai \
# --gpus all \
# -p 8080:8080 \
# -v ~/ai-stack/localai/models:/models \
# -v ~/ai-stack/localai/config:/config \
# -e ENABLE_BACKENDS=llama-cuda,ollama \
# -e INCLUDE_DEFAULT_MODELS=true \
# -e AUTOLOAD_MODELS=true \
# -e MODEL_PATH=/models \
# --restart unless-stopped \
# localai/localai:latest-aio-gpu-nvidia-cuda-12
# echo "🌐 LocalAI is now running at http://localhost:8080"
# fi
# fi
# fi
if [[ "$1" != "--update" ]]; then
if check_container_running "localai"; then
echo "✅ Skipping LocalAI install (already running)."
else
read -p " Install LocalAI (GPU-custom)? [y/N]: " localai_prompt
if [[ "$localai_prompt" =~ ^[Yy]$ ]]; then
echo "🧠 Installing LocalAI (Custom created localAI container)..."
mkdir -p ~/ai-stack/localai/models
mkdir -p ~/ai-stack/localai/config
echo "📦 Using custom built LocalAI image (localai:custom)"
docker run -d \ docker run -d \
--name localai \ --name localai \
--gpus all \ --gpus all \
--network ai-stack-net \
-p 8080:8080 \ -p 8080:8080 \
-v ~/ai-stack/localai/models:/models \ -v ~/ai-stack/localai/models:/models \
-v ~/ai-stack/localai/models:/app/models \ -v ~/ai-stack/localai/config:/config \
-e ENABLE_BACKENDS=llama-cuda,whispercpp,stablediffusion,ollama \ -e ENABLE_BACKENDS=llama-cuda,ollama \
-e INCLUDE_DEFAULT_MODELS=true \ -e INCLUDE_DEFAULT_MODELS=true \
-e AUTOLOAD_MODELS=true \ -e AUTOLOAD_MODELS=true \
-e MODEL_PATH=/models \ -e MODEL_PATH=/models \
-e LOG_LEVEL=debug \
--restart unless-stopped \ --restart unless-stopped \
localai:custom localai/localai:latest-aio-gpu-nvidia-cuda-12
echo "🌐 LocalAI is now running at http://localhost:8080" echo "🌐 LocalAI is now running at http://localhost:8080"
fi fi
fi fi
fi fi
# if [[ "$1" != "--update" ]]; then
# if check_container_running "localai"; then
# echo "✅ Skipping LocalAI install (already running)."
# else
# read -p " Install LocalAI (GPU-custom)? [y/N]: " localai_prompt
# if [[ "$localai_prompt" =~ ^[Yy]$ ]]; then
# echo "🧠 Installing LocalAI (Custom created localAI container)..."
# mkdir -p ~/ai-stack/localai/models
# mkdir -p ~/ai-stack/localai/config
# echo "📦 Using custom built LocalAI image (localai:custom)"
# docker run -d \
# --name localai \
# --gpus all \
# --network ai-stack-net \
# -p 8080:8080 \
# -v ~/ai-stack/localai/models:/models \
# -v ~/ai-stack/localai/models:/app/models \
# -e ENABLE_BACKENDS=llama-cuda,whispercpp,stablediffusion,ollama \
# -e INCLUDE_DEFAULT_MODELS=true \
# -e AUTOLOAD_MODELS=true \
# -e MODEL_PATH=/models \
# -e LOG_LEVEL=debug \
# --restart unless-stopped \
# localai:custom
# echo "🌐 LocalAI is now running at http://localhost:8080"
# fi
# fi
# fi