-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-entrypoint.sh
More file actions
36 lines (28 loc) · 1.18 KB
/
Copy pathdocker-entrypoint.sh
File metadata and controls
36 lines (28 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh
set -e
echo "[entrypoint] Starting ShadowAI..."
# Ensure runtime directories exist (in case the volume was freshly mounted)
mkdir -p /app/data/chats /app/run
# -------------------------------------------------------------------------
# config.json lives inside the data volume so it persists across container
# recreations (docker-compose down/up). We symlink /app/config.json to it.
# -------------------------------------------------------------------------
DATA_CONFIG="/app/data/config.json"
APP_CONFIG="/app/config.json"
if [ ! -f "$DATA_CONFIG" ]; then
echo "[entrypoint] Initialising config.json from defaults..."
cp /app/config.default.json "$DATA_CONFIG"
fi
# If a real (non-symlink) file exists at /app/config.json, migrate it
if [ -f "$APP_CONFIG" ] && [ ! -L "$APP_CONFIG" ]; then
echo "[entrypoint] Migrating existing config.json into data volume..."
cp "$APP_CONFIG" "$DATA_CONFIG"
rm "$APP_CONFIG"
fi
# Create symlink so server.js finds config.json at the expected path
if [ ! -L "$APP_CONFIG" ]; then
ln -s "$DATA_CONFIG" "$APP_CONFIG"
fi
# Apply any environment variable overrides (OLLAMA_URL, ADMIN_PASSWORD, etc.)
node /app/docker-init.js
exec node server.js