From 67e622e6ec2cbc091f0497eafc5048a08123f9b1 Mon Sep 17 00:00:00 2001 From: Ralf Vogler Date: Sat, 24 Dec 2022 15:02:28 +0100 Subject: [PATCH] docker: move firefox install up to other apt deps; --with-deps needed! MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without --with-deps we get and error starting the browser: node:internal/process/esm_loader:108 internalBinding('errors').triggerUncaughtException( ^ browserType.launchPersistentContext: ╔══════════════════════════════════════════════════════╗ ║ Host system is missing dependencies to run browsers. ║ ║ Please install them with the following command: ║ ║ ║ ║ npx playwright install-deps ║ ║ ║ ║ Alternatively, use apt: ║ ║ apt-get install libgtk-3-0\ ║ ║ libasound2\ ║ ║ libxcomposite1\ ║ ║ libpangocairo-1.0-0\ ║ ║ libpango-1.0-0\ ║ ║ libatk1.0-0\ ║ ║ libcairo-gobject2\ ║ ║ libcairo2\ ║ ║ libgdk-pixbuf-2.0-0\ ║ ║ libdbus-glib-1-2\ ║ ║ libxcursor1 ║ ║ ║ ║ <3 Playwright Team ║ ╚══════════════════════════════════════════════════════╝ at async file:///fgc/prime-gaming.js:25:17 { name: 'Error' } --- Dockerfile | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index b2a17f1..e5937b3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,12 +2,15 @@ # Partially from https://github.com/microsoft/playwright/blob/main/utils/docker/Dockerfile.focal FROM ubuntu:jammy +# Configuration variables are at the end! + # https://github.com/hadolint/hadolint/wiki/DL4006 SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG DEBIAN_FRONTEND=noninteractive ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD true -# Install up-to-date node & npm, then deps for virtual screen & noVNC +# Install up-to-date node & npm, deps for virtual screen & noVNC, browser. +# Playwright needs --with-deps for firefox. RUN apt-get update \ && apt-get install -y curl \ && curl -fsSL https://deb.nodesource.com/setup_19.x | bash - \ @@ -19,6 +22,7 @@ RUN apt-get update \ tini \ novnc websockify \ dos2unix \ + && npx playwright install --with-deps firefox \ && apt-get clean \ && rm -rf \ /tmp/* \ @@ -32,16 +36,11 @@ RUN ln -s /usr/share/novnc/vnc_auto.html /usr/share/novnc/index.html WORKDIR /fgc COPY package*.json ./ -# Install browser & dependencies only -RUN npm install \ - && npx playwright install --with-deps firefox \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* +RUN npm install COPY . . -# Shell scripts -# On windows, git might be configured to check out dos/CRLF line endings, so we convert them for those people in case they want to build the image. +# Shell scripts need Linux line endings. On Windows, git might be configured to check out dos/CRLF line endings, so we convert them for those people in case they want to build the image. RUN dos2unix ./docker/*.sh RUN mv ./docker/entrypoint.sh /usr/local/bin/entrypoint \ && chmod +x /usr/local/bin/entrypoint