Files
PMOCrazycoder/docker-entrypoint.sh

30 lines
861 B
Bash
Raw Normal View History

#!/bin/bash
# docker-entrypoint.sh
# --- Initialise .ai_index si nécessaire ---
if [ ! -d "/workspace/.ai_index" ]; then
mkdir -p /workspace/.ai_index/ast
mkdir -p /workspace/.ai_index/embeddings
touch /workspace/.ai_index/graph.db
fi
# --- Configure LOCAL_LLM_API pour Bash ---
if [ -n "$LOCAL_LLM_API" ]; then
if ! grep -q "LOCAL_LLM_API" /home/devuser/.bashrc; then
echo "export LOCAL_LLM_API=$LOCAL_LLM_API" >> /home/devuser/.bashrc
fi
fi
# --- Lance MCP server en background si pas déjà lancé ---
if [ ! -f "/workspace/.ai_index/mcp.pid" ] || ! kill -0 $(cat /workspace/.ai_index/mcp.pid) 2>/dev/null; then
/opt/bin/mcp-server >/workspace/.ai_index/mcp.log 2>&1 &
echo $! >/workspace/.ai_index/mcp.pid
fi
# --- Force Bash comme shell par défaut ---
if [ -z "$1" ]; then
exec /bin/bash
else
exec "$@"
fi