2026-02-21 13:17:51 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
# docker-entrypoint.sh
|
|
|
|
|
|
2026-02-21 16:34:17 +01:00
|
|
|
# --- Initialise .ai_index si nécessaire ---
|
2026-02-21 13:17:51 +01:00
|
|
|
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
|
|
|
|
|
|
2026-02-21 16:34:17 +01:00
|
|
|
# --- 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
|
2026-02-21 13:17:51 +01:00
|
|
|
|
2026-02-21 16:34:17 +01:00
|
|
|
# --- Force Bash comme shell par défaut ---
|
|
|
|
|
if [ -z "$1" ]; then
|
|
|
|
|
exec /bin/bash
|
|
|
|
|
else
|
|
|
|
|
exec "$@"
|
|
|
|
|
fi
|