From ece24e182f904ecea58c69cb9068818559fb9911 Mon Sep 17 00:00:00 2001 From: devlikepro Date: Mon, 16 Jun 2025 12:48:15 +0700 Subject: [PATCH] [core] WEBJS - xvfb --- Dockerfile | 15 +++++++++++++++ entrypoint.sh | 5 +++++ 2 files changed, 20 insertions(+) diff --git a/Dockerfile b/Dockerfile index cbbe5c1f..6d0717ad 100644 --- a/Dockerfile +++ b/Dockerfile @@ -119,6 +119,21 @@ RUN if [ "$USE_BROWSER" = "chromium" ] || [ "$USE_BROWSER" = "chrome" ]; then \ && rm -rf /var/lib/apt/lists/*; \ fi +# Install xvfb +RUN if [ "$USE_BROWSER" = "chromium" ] || [ "$USE_BROWSER" = "chrome" ]; then \ + apt-get update && apt-get install -y --no-install-recommends \ + xvfb \ + libnss3 \ + libxss1 \ + libasound2 \ + libatk-bridge2.0-0 \ + libgtk-3-0 \ + libdrm2 \ + ca-certificates \ + curl \ + && rm -rf /var/lib/apt/lists/*; \ + fi + # Install Chromium RUN if [ "$USE_BROWSER" = "chromium" ]; then \ apt-get update \ diff --git a/entrypoint.sh b/entrypoint.sh index 1d86ef6c..c2426830 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,5 +1,10 @@ #!/bin/sh +# Start virtual X server in the background +Xvfb :99 -screen 0 1280x720x24 & +export DISPLAY=:99 +sleep 2 + # Calculate UV_THREADPOOL_SIZE based on number of CPUs cpus=$(node -e "const os = require('os'); console.log(os.cpus().length);") uv_threadpool_size=$(($cpus * 1))