-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-entrypoint.sh
More file actions
52 lines (43 loc) · 1.54 KB
/
docker-entrypoint.sh
File metadata and controls
52 lines (43 loc) · 1.54 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/sh
echo "Starting ScoutBot v0.03 (Karina Katarazzo)..."
# Ensure PATH includes standard binary directories
export PATH="/usr/local/bin:/usr/bin:/bin:${PATH}"
# Create data directory if it doesn't exist
mkdir -p /app/data
# Set database URL if not already set
export DATABASE_URL=${DATABASE_URL:-file:/app/data/production.db}
# Set timezone from environment variable (defaults to UTC if not set)
if [ -n "${TZ}" ]; then
echo "🌍 Setting timezone to ${TZ}..."
export TZ
# Install tzdata if not already installed (for timezone support)
if [ ! -f /usr/share/zoneinfo/${TZ} ]; then
echo "⚠️ Warning: Timezone ${TZ} not found, using UTC"
export TZ=UTC
else
ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime
echo "✅ Timezone set to ${TZ}"
fi
else
echo "⚠️ TZ environment variable not set, using UTC"
export TZ=UTC
fi
# Wait for Redis to be ready (if not disabled)
if [ "${DISABLE_REDIS}" != "true" ]; then
echo "⏳ Waiting for Redis to be ready..."
until nc -z ${REDIS_HOST:-redis} ${REDIS_PORT:-6379} 2>/dev/null; do
echo "Waiting for Redis..."
sleep 1
done
echo "✅ Redis is ready"
fi
# Start Xvfb (virtual display) for headless Chromium (PO Token Provider)
if [ -n "${DISPLAY}" ]; then
echo "🖥️ Starting Xvfb virtual display..."
Xvfb ${DISPLAY} -screen 0 1280x720x24 >/dev/null 2>&1 &
sleep 1 # Give Xvfb time to start
echo "✅ Xvfb started on ${DISPLAY}"
fi
# Start the application
echo "🎯 Starting ScoutBot..."
exec python run.py