From 65a389c3d926f3031a073458a79ccb33a019abc4 Mon Sep 17 00:00:00 2001 From: Ralf Vogler Date: Sun, 5 Feb 2023 23:33:45 +0100 Subject: [PATCH] docker: don't pin playwright, split: system deps + firefox after `npm install` `npx playwright install --with-deps firefox` fails since package.json references 1.29 but current version is 1.30: `browserType.launchPersistentContext: Executable doesn't exist at /root/.cache/ms-playwright/firefox-1369/firefox/firefox` Need to either pin the version there or install the browser after `npm install` which will make it take into account the package.json version. See https://github.com/microsoft/playwright/issues/13188, https://github.com/microsoft/playwright/issues/12835 Image size: 1. 1.12GB - `npx playwright install --with-deps firefox` -> fails due to wrong browser version 2. 1.12GB - `npx playwright@1.29 install --with-deps firefox` -> pinning version works, but need to also update Dockerfile when updating package.json 3. 920MB - `npx playwright install-deps firefox` -> fails, system deps only, no browser 4. 1.12GB - 3. + `npx install firefox` after `npm install` -> works, no pinning needed, system deps stuff is cleaned up with the rest of the apt installs; breaks if system deps change... --- Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 95b4d0f..6967e08 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,7 +23,7 @@ RUN apt-get update \ novnc websockify \ dos2unix \ python3-pip \ - && npx playwright@1.29 install --with-deps firefox \ + && npx playwright install-deps firefox \ && apt-get clean \ && rm -rf \ /tmp/* \ @@ -38,7 +38,8 @@ RUN pip install apprise WORKDIR /fgc COPY package*.json ./ -RUN npm install +# If firefox is installed (~/.cache/ms-playwright/firefox-*) before `npm install` it may be a newer version than in package.json and playwright will not find it; system deps are installed sep. via apt above to avoid having to pin the version there. +RUN npm install && npx playwright install firefox COPY . .