autgen / startup.sh
StarrySkyWorld's picture
refactor: 替换 undetected-chromedriver 为 seleniumbase,并简化 VNC 相关配置
c94202e
raw
history blame contribute delete
970 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 "${CHROME_BIN:-}" ]; then
if [ -x /usr/bin/chromium-browser ]; then
export CHROME_BIN=/usr/bin/chromium-browser
elif [ -x /usr/bin/chromium ]; then
export CHROME_BIN=/usr/bin/chromium
fi
fi
if [ -z "${DISABLE_XVFB:-}" ] && command -v Xvfb >/dev/null 2>&1; then
echo "Starting Xvfb for virtual display."
Xvfb :99 -screen 0 1280x720x24 >/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