#!/usr/bin/env bash set -euo pipefail echo "[entrypoint] starting up" mkdir -p /tmp/.X11-unix chmod 1777 /tmp/.X11-unix 2>/dev/null || true pkill -x Xvfb 2>/dev/null || true rm -f /tmp/.X11-unix/X99 2>/dev/null || true echo "[entrypoint] starting Xvfb on :99" Xvfb :99 -screen 0 1280x720x24 \ -ac \ +extension GLX \ +extension RANDR \ +render \ -noreset \ -nolisten tcp >/tmp/xvfb.log 2>&1 & XVFB_PID=$! cleanup() { echo "[entrypoint] shutting down" kill "$XVFB_PID" 2>/dev/null || true wait "$XVFB_PID" 2>/dev/null || true } trap cleanup SIGTERM SIGINT EXIT for i in $(seq 1 40); do if xdpyinfo -display :99 >/dev/null 2>&1; then echo "[entrypoint] display :99 is ready" break fi if ! kill -0 "$XVFB_PID" >/dev/null 2>&1; then echo "[entrypoint] Xvfb died early" cat /tmp/xvfb.log || true exit 1 fi sleep 0.5 done export DISPLAY=:99 echo "[entrypoint] DISPLAY=$DISPLAY" exec python -u server.py