ehhhh / startup.sh
StarrySkyWorld's picture
生成提交信息中
e116349
raw
history blame contribute delete
757 Bytes
#!/bin/sh
set -e
echo "===== Application Startup at $(date -u +"%Y-%m-%d %H:%M:%S") ====="
if [ ! -f /app/config.json ] && [ -f /app/example.config.json ]; then
cp /app/example.config.json /app/config.json
fi
if [ -z "${DISABLE_XVFB:-}" ] && command -v Xvfb >/dev/null 2>&1; then
echo "Starting Xvfb for virtual display."
Xvfb :99 -screen 0 1366x768x24 >/tmp/xvfb.log 2>&1 &
export DISPLAY=:99
sleep 1
if ps | grep -q "[X]vfb"; then
echo "Xvfb started on DISPLAY=${DISPLAY}."
else
echo "Xvfb failed to start, continuing without DISPLAY."
unset DISPLAY
fi
else
echo "Xvfb not available or disabled; continuing without DISPLAY."
fi
exec uvicorn server:app --host 0.0.0.0 --port "${PORT:-7860}" --log-level debug --access-log