tfrere HF Staff commited on
Commit
d13608d
·
1 Parent(s): 1f03cd7

fix(docker): invoke playwright CLI by package path to survive --omit=dev

Browse files

`npm install --omit=dev` in the production stage skips @playwright /test but
leaves a dangling `.bin/playwright` symlink that used to resolve to it.
`npx playwright` then fails with "playwright: not found" even though the
runtime `playwright` package is installed.

Call `node node_modules/playwright/cli.js install chromium` directly to
bypass the `.bin/` lookup and install the Chromium browser from the
production `playwright` package.

Made-with: Cursor

Files changed (1) hide show
  1. Dockerfile +6 -2
Dockerfile CHANGED
@@ -57,9 +57,13 @@ COPY backend/package.json backend/package-lock.json* ./
57
  RUN npm install --omit=dev
58
  COPY --from=backend-build /app/dist ./dist
59
 
60
- # Install Playwright Chromium browser binaries
 
 
 
 
61
  ENV PLAYWRIGHT_BROWSERS_PATH=/app/browsers
62
- RUN npx playwright install chromium
63
 
64
  # Copy frontend build
65
  COPY --from=frontend-build /app/frontend/dist ./frontend-dist
 
57
  RUN npm install --omit=dev
58
  COPY --from=backend-build /app/dist ./dist
59
 
60
+ # Install Playwright Chromium browser binaries.
61
+ # We invoke the playwright CLI through its package path instead of `npx
62
+ # playwright` because the `.bin/playwright` symlink clashes with the one
63
+ # shipped by @playwright/test (dev-only) and isn't recreated when npm is run
64
+ # with --omit=dev.
65
  ENV PLAYWRIGHT_BROWSERS_PATH=/app/browsers
66
+ RUN node node_modules/playwright/cli.js install chromium
67
 
68
  # Copy frontend build
69
  COPY --from=frontend-build /app/frontend/dist ./frontend-dist