8
This commit is contained in:
@@ -5,6 +5,19 @@ FROM localai/localai:latest-cpu
|
||||
ENV LOCALAI_P2P="true"
|
||||
ENV LOCALAI_FEDERATED="true"
|
||||
|
||||
# Installer bashio pour accéder à la configuration Home Assistant
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
curl jq && \
|
||||
curl -J -L -o /tmp/bashio.tar.gz \
|
||||
"https://github.com/hassio-addons/bashio/archive/v0.16.2.tar.gz" && \
|
||||
mkdir /tmp/bashio && \
|
||||
tar zxvf /tmp/bashio.tar.gz --strip 1 -C /tmp/bashio && \
|
||||
mv /tmp/bashio/lib /usr/lib/bashio && \
|
||||
ln -s /usr/lib/bashio/bashio /usr/bin/bashio && \
|
||||
rm -rf /tmp/bashio* && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY run.sh /build/custom-entrypoint.sh
|
||||
RUN chmod +x /build/custom-entrypoint.sh
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Configuration par défaut si bashio n'est pas disponible
|
||||
if command -v bashio >/dev/null 2>&1; then
|
||||
echo "Using Home Assistant configuration"
|
||||
GPU_LAYERS="$(bashio::config 'gpu_layers')"
|
||||
TOKEN="$(bashio::config 'master_token')"
|
||||
MODELS_PATH="$(bashio::config 'models_path')"
|
||||
else
|
||||
echo "Using environment variables"
|
||||
GPU_LAYERS="${GPU_LAYERS:-99}"
|
||||
TOKEN="${LOCALAI_P2P_TOKEN:-}"
|
||||
MODELS_PATH="${LOCALAI_MODELS_PATH:-/share/localai/models}"
|
||||
# Forcer l'utilisation de la configuration Home Assistant
|
||||
echo "Using Home Assistant configuration"
|
||||
|
||||
# Source bashio si disponible
|
||||
if [ -f /usr/bin/bashio ]; then
|
||||
source /usr/bin/bashio
|
||||
fi
|
||||
|
||||
GPU_LAYERS="$(bashio::config 'gpu_layers' 2>/dev/null || echo '99')"
|
||||
TOKEN="$(bashio::config 'master_token' 2>/dev/null || echo '')"
|
||||
MODELS_PATH="$(bashio::config 'models_path' 2>/dev/null || echo '/share/localai/models')"
|
||||
|
||||
echo "DEBUG: GPU_LAYERS=$GPU_LAYERS"
|
||||
echo "DEBUG: TOKEN from config: '$TOKEN'"
|
||||
echo "DEBUG: MODELS_PATH=$MODELS_PATH"
|
||||
@@ -39,6 +38,10 @@ find "$MODELS_PATH" -name "*.yaml" -exec grep -l "#!/usr/bin/with-contenv bashio
|
||||
rm -f "$file"
|
||||
done 2>/dev/null || true
|
||||
|
||||
# Définir les variables d'environnement pour LocalAI
|
||||
export THREADS="${THREADS:-8}"
|
||||
export OMP_NUM_THREADS="${OMP_NUM_THREADS:-8}"
|
||||
|
||||
# Lancer LocalAI avec nos paramètres
|
||||
echo "DEBUG: Starting LocalAI with models-path=$MODELS_PATH, gpu-layers=$GPU_LAYERS"
|
||||
exec /build/local-ai run --models-path="$MODELS_PATH" --gpu-layers="$GPU_LAYERS" --address="0.0.0.0:8080" --cors --cors-allow-origins="*"
|
||||
echo "DEBUG: Starting LocalAI with models-path=$MODELS_PATH, threads=$THREADS"
|
||||
exec /build/local-ai run --models-path="$MODELS_PATH" --threads="$THREADS" --address="0.0.0.0:8080" --cors --cors-allow-origins="*"
|
||||
|
||||
@@ -5,6 +5,19 @@ FROM localai/localai:latest-cpu
|
||||
ENV LOCALAI_P2P="true"
|
||||
ENV LOCALAI_FEDERATED="true"
|
||||
|
||||
# Installer bashio pour accéder à la configuration Home Assistant
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
curl jq && \
|
||||
curl -J -L -o /tmp/bashio.tar.gz \
|
||||
"https://github.com/hassio-addons/bashio/archive/v0.16.2.tar.gz" && \
|
||||
mkdir /tmp/bashio && \
|
||||
tar zxvf /tmp/bashio.tar.gz --strip 1 -C /tmp/bashio && \
|
||||
mv /tmp/bashio/lib /usr/lib/bashio && \
|
||||
ln -s /usr/lib/bashio/bashio /usr/bin/bashio && \
|
||||
rm -rf /tmp/bashio* && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY run.sh /build/custom-entrypoint.sh
|
||||
RUN chmod +x /build/custom-entrypoint.sh
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name: "LocalAI P2P Worker"
|
||||
version: "1.0.3.7" # Incrémentez aussi la version
|
||||
version: "1.0.3.8" # Incrémentez aussi la version
|
||||
slug: "localai-p2p-worker" # ⬅️ IMPORTANT : doit correspondre au nom du dossier
|
||||
description: "LocalAI P2P federation worker node"
|
||||
arch:
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Configuration par défaut si bashio n'est pas disponible
|
||||
if command -v bashio >/dev/null 2>&1; then
|
||||
echo "Using Home Assistant configuration"
|
||||
GPU_LAYERS="$(bashio::config 'gpu_layers')"
|
||||
TOKEN="$(bashio::config 'master_token')"
|
||||
MODELS_PATH="$(bashio::config 'models_path')"
|
||||
else
|
||||
echo "Using environment variables"
|
||||
GPU_LAYERS="${GPU_LAYERS:-0}"
|
||||
TOKEN="${LOCALAI_P2P_TOKEN:-}"
|
||||
MODELS_PATH="${LOCALAI_MODELS_PATH:-/share/localai/models}"
|
||||
# Forcer l'utilisation de la configuration Home Assistant
|
||||
echo "Using Home Assistant configuration"
|
||||
|
||||
# Source bashio si disponible
|
||||
if [ -f /usr/bin/bashio ]; then
|
||||
source /usr/bin/bashio
|
||||
fi
|
||||
|
||||
GPU_LAYERS="$(bashio::config 'gpu_layers' 2>/dev/null || echo '0')"
|
||||
TOKEN="$(bashio::config 'master_token' 2>/dev/null || echo '')"
|
||||
MODELS_PATH="$(bashio::config 'models_path' 2>/dev/null || echo '/share/localai/models')"
|
||||
|
||||
echo "DEBUG: GPU_LAYERS=$GPU_LAYERS"
|
||||
echo "DEBUG: TOKEN from config: '$TOKEN'"
|
||||
echo "DEBUG: MODELS_PATH=$MODELS_PATH"
|
||||
@@ -39,6 +38,10 @@ find "$MODELS_PATH" -name "*.yaml" -exec grep -l "#!/usr/bin/with-contenv bashio
|
||||
rm -f "$file"
|
||||
done 2>/dev/null || true
|
||||
|
||||
# Définir les variables d'environnement pour LocalAI
|
||||
export THREADS="${THREADS:-8}"
|
||||
export OMP_NUM_THREADS="${OMP_NUM_THREADS:-8}"
|
||||
|
||||
# Lancer LocalAI avec nos paramètres
|
||||
echo "DEBUG: Starting LocalAI with models-path=$MODELS_PATH, gpu-layers=$GPU_LAYERS"
|
||||
exec /build/local-ai run --models-path="$MODELS_PATH" --gpu-layers="$GPU_LAYERS" --address="0.0.0.0:8080" --cors --cors-allow-origins="*"
|
||||
echo "DEBUG: Starting LocalAI with models-path=$MODELS_PATH, threads=$THREADS"
|
||||
exec /build/local-ai run --models-path="$MODELS_PATH" --threads="$THREADS" --address="0.0.0.0:8080" --cors --cors-allow-origins="*"
|
||||
|
||||
Reference in New Issue
Block a user