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...
This commit is contained in:
Ralf Vogler 2023-02-05 23:33:45 +01:00
parent b9e9abe546
commit 65a389c3d9

View file

@ -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 . .