This commit is contained in:
+17
-7
@@ -86,16 +86,26 @@ ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
|
||||
|
||||
COPY package.json package-lock.json* ./
|
||||
# build-essential compiles better-sqlite3's native addon (removed afterward to
|
||||
# stay lean). `npx playwright install --with-deps chromium` downloads the
|
||||
# Chromium binary INTO PLAYWRIGHT_BROWSERS_PATH and installs its shared-library
|
||||
# apt deps in one step. NOTE: `npm ci` alone does NOT download the browser —
|
||||
# Playwright dropped the npm-install postinstall browser download, so relying on
|
||||
# it left /ms-playwright absent and the chmod below failing on a clean build
|
||||
# (issue #528). chmod makes the browser readable by the non-root `node` user.
|
||||
# stay lean). `playwright install --with-deps chromium` downloads the Chromium
|
||||
# binary INTO PLAYWRIGHT_BROWSERS_PATH and installs its shared-library apt deps
|
||||
# in one step. NOTE: `npm ci` alone does NOT download the browser — Playwright
|
||||
# dropped the npm-install postinstall browser download, so relying on it left
|
||||
# /ms-playwright absent and the chmod below failing on a clean build (issue
|
||||
# #528). chmod makes the browser readable by the non-root `node` user.
|
||||
#
|
||||
# We invoke the CLI as `node node_modules/playwright/cli.js` rather than
|
||||
# `npx playwright`: prod `playwright` and dev `@playwright/test` both declare a
|
||||
# `playwright` bin, and lockfile generation resolves that collision in favour of
|
||||
# `@playwright/test`. That ownership is baked into package-lock.json, so even a
|
||||
# CLEAN `npm ci --omit=dev` (with @playwright/test absent) does NOT relink
|
||||
# node_modules/.bin/playwright to the prod package — the bin is simply missing
|
||||
# and `npx playwright` fails with exit 127 (issue #007). Calling the package's
|
||||
# own cli.js sidesteps bin resolution entirely and is version-matched to the
|
||||
# installed prod `playwright`.
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends build-essential \
|
||||
&& npm ci --omit=dev \
|
||||
&& npx playwright install --with-deps chromium \
|
||||
&& node node_modules/playwright/cli.js install --with-deps chromium \
|
||||
&& chmod -R go+rX /ms-playwright \
|
||||
&& npm cache clean --force \
|
||||
&& apt-get purge -y build-essential \
|
||||
|
||||
Reference in New Issue
Block a user