From 38f4390147e92ff9b94a7b58310721fef1618219 Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Sat, 8 Nov 2025 00:03:03 +0100 Subject: [PATCH] Add Xvfb support to the dockerfile This enables headless browser testing including WebGL support. firefox --headless does not support rendering WebGL without such a virtual display --- Dockerfile | 9 +++++++++ docker/entrypoint.sh | 9 +++++++++ 2 files changed, 18 insertions(+) create mode 100644 docker/entrypoint.sh diff --git a/Dockerfile b/Dockerfile index a50425b21..b3f517142 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,6 +30,9 @@ RUN apt-get update \ osmosis \ ca-certificates \ firefox-esr \ + xvfb \ + mesa-utils \ + libgl1-mesa-dri \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* # Replace with `apt-get dist-clean` after upgrading to Debian 13 (Trixie) @@ -50,3 +53,9 @@ RUN bundle install COPY package.json yarn.lock /app/ COPY bin/yarn /app/bin/ RUN bundle exec bin/yarn install + +# Copy and set entrypoint +COPY docker/entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh + +ENTRYPOINT ["/entrypoint.sh"] diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100644 index 000000000..df6a77cd6 --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,9 @@ +#!/bin/sh +set -e + +# Start Xvfb in the background for headless browser testing +export DISPLAY=:99.0 +Xvfb $DISPLAY -screen 0 1024x768x24 & + +# main command +exec "$@" -- 2.39.5