Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Dockerfile for Firefox #1937

Merged
merged 1 commit into from
Apr 23, 2020
Merged

fix: Dockerfile for Firefox #1937

merged 1 commit into from
Apr 23, 2020

Conversation

mxschmitt
Copy link
Member

@mxschmitt mxschmitt commented Apr 23, 2020

Tested with:

const playwright = require("playwright");

(async () => {
  for (const browserType of ['chromium', 'webkit', 'firefox']) {
    const browser = await playwright[browserType].launch({
      logger: {
        isEnabled: (name, severity) => true,
        log: (name, severity, message, args) => console.log(`${name} ${message}`)
      }
    });
    const context = await browser.newContext();
    const page = await context.newPage();
    await page.goto('http://whatsmyuseragent.org/');
    await page.screenshot({ path: `example-${browserType}.png` });
    await browser.close();
  }
})();

Logs:

ackend_1   | browser <launching> /backend/node_modules/playwright/.local-browsers/firefox/firefox/firefox -no-remote -headless -profile /tmp/playwright_dev_firefox_profile-5vUzFi -juggler 0 -silent
backend_1   | browser <launched> pid=18
backend_1   | browser:err XPCOMGlueLoad error for file /backend/node_modules/playwright/.local-browsers/firefox/firefox/libxul.so:
backend_1   | browser:err libXt.so.6: cannot open shared object file: No such file or directory
backend_1   | browser:err Couldn't load XPCOM.
backend_1   | browser <process did exit 255, null>
backend_1   | /backend/node_modules/playwright-core/lib/server/firefox.js:109
backend_1   |                 if (browserServer)
backend_1   |                 ^
backend_1   | 
backend_1   | ReferenceError: Cannot access 'browserServer' before initialization
backend_1   |     at Object.onkill (/backend/node_modules/playwright-core/lib/server/firefox.js:109:17)
backend_1   |     at ChildProcess.<anonymous> (/backend/node_modules/playwright-core/lib/server/processLauncher.js:76:21)
backend_1   |     at Object.onceWrapper (events.js:417:26)
backend_1   |     at ChildProcess.emit (events.js:310:20)
backend_1   |     at ChildProcess.EventEmitter.emit (domain.js:482:12)
backend_1   |     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)

Before that change Firefox was not working. By installing this new dependency, it works.

Maybe we should setup a build bot for it to guarantee, that the Dockerfile can start all the browsers?

Side note: @arjun27 had it also in his Dockerfile.

Closes #1622

@yury-s
Copy link
Member

yury-s commented Apr 23, 2020

Thank you for the fix!

@yury-s yury-s merged commit b516ac4 into microsoft:master Apr 23, 2020
aslushnikov added a commit that referenced this pull request Jul 14, 2020
This adds a new script to calculate docker image size with
all parent layers.

Note: take this metrics with a grain of salt, since in reality
docker compresses and reuses layers.

Some historic stats obtained with this script:
- **`208MB`** (-33MB) chore(docker): skip "recommended" dependencies (#2917) (1cebf87)
- **`241MB`** (-29MB) chore(docker): trim some of the gstreamer dependencies (#2897) (bce4b1a)
- **`272MB`** (-1MB) devops: do cache busting for APT (#2656) (bb34418)
- **`273MB`** (+49MB) fix(webkit): update Docker file to include gstreamer (#2636) (5c6c659)
- **`224MB`** (+0MB) chore: fix emojis for CR and FF in Dockerfile (#2522) (24316ad)
- **`224MB`** (-1MB) fix: Dockerfile for Firefox (#1937) (b516ac4)
- **`225MB`** (+49MB) devops(docker): Install ffmpeg dependency, adding codecs necessary for video playback in Firefox (#1627) (222d01c)
-  **`176MB`** (+32MB) chore(docs): optionally install XVFB in docker(ec3ee66)
-  **`144MB`** (+144MB)  feat: add a playwright-ready docker image (#1161)(1781ae7)
@mxschmitt mxschmitt deleted the patch-3 branch November 13, 2024 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Example Dockerfile browser Dependencies
2 participants