#!/bin/sh set -eu Xvfb :99 -screen 0 "${SCREEN_SIZE:-1920x1080x24}" -nolisten tcp -ac & xvfb_pid=$! for _ in 1 2 3 4 5 6 7 8 9 10; do [ -S /tmp/.X11-unix/X99 ] && break kill -0 "$xvfb_pid" 2>/dev/null || exit 1 sleep 0.1 done [ -S /tmp/.X11-unix/X99 ] || { echo "Xvfb did not become ready" >&2 exit 1 } export DISPLAY=:99 remote_debugging_port=${REMOTE_DEBUGGING_PORT:-9222} case "$remote_debugging_port" in ''|*[!0-9]*) echo "REMOTE_DEBUGGING_PORT must be numeric" >&2; exit 2 ;; esac socat \ "TCP-LISTEN:${remote_debugging_port},fork,reuseaddr,bind=$(hostname -i)" \ "TCP:127.0.0.1:${remote_debugging_port}" & exec /opt/chromium/chrome \ --disable-dev-shm-usage \ --no-sandbox \ --no-default-browser-check \ --no-first-run \ --remote-debugging-port="$remote_debugging_port" \ --user-data-dir=/data \ "$@"