项目作者: femtopixel

项目描述 :
Google Lighthouse - Docker Image
高级语言: Dockerfile
项目地址: git://github.com/femtopixel/docker-google-lighthouse.git
创建时间: 2017-11-02T16:52:47Z
项目社区:https://github.com/femtopixel/docker-google-lighthouse

开源协议:MIT License

下载


[!CAUTION]
As-of 2021, this product does not have a free support team anymore. If you want this product to be maintained, please support my work.

[!NOTE]
(This product is available under a free and permissive license, but needs financial support to sustain its continued improvements. In addition to maintenance and stability there are many desirable features yet to be added.)

[!TIP]
THIS REPOSITORY IS AUTO-UPDATED BY GITHUB-RELEASE-NOTIFIER (https://github.com/femtopixel/github-release-notifier)

logo

Google Lighthouse - Docker Image

latest release
Docker Pulls
Docker Stars
PayPal donation
Buy me a coffee
Buy me a coffee

Lighthouse analyzes web apps and web pages, collecting modern performance metrics and insights on developer best practices.

This image is greatly inspired from Justin RIBEIRO’s work

Usage

  1. docker run --rm --name lighthouse -it -v /path/to/your/report:/home/chrome/reports femtopixel/google-lighthouse <your_site_url> <optional_args>

With <you_site_url> url to your site (e.g. http://www.google.com). You can pass args AFTER the url if you want to.

For example, you can export as json with this command:

  1. docker run --rm --name lighthouse -it -v /path/to/your/report:/home/chrome/reports femtopixel/google-lighthouse http://www.google.com --output json

You can specify CHROME_FLAGS environment variable (-e parameter in your docker command) to be used in chrome-flags parameter. (default: --headless --disable-gpu --no-sandbox)

Further reading on Google Lighthouse

FAQ

  • Error while writing files
    1. Runtime error encountered: { Error: EACCES: permission denied, open '/home/chrome/reports/myawesome_site_admin_heavypage.report.json'
    2. errno: -13,
    3. code: 'EACCES',
    4. syscall: 'open',
    5. path: '/home/chrome/reports/myawesome_site_admin_heavypage.report.json' }
    Make sure your folder has the write right for others (chmod o+w)

If the issue still occurs, you may want to add --disable-shm-dev-usage Chrome flag (cf. https://stackoverflow.com/questions/69173469/meaning-of-selenium-chromeoptions/69175552#69175552 and https://issues.chromium.org/issues/40517415; thx @kevinbreit - https://github.com/femtopixel/docker-google-lighthouse/issues/25)

You can add this flag with the -e flag in your docker command docker run --rm --name lighthouse -it -e CHROME_FLAGS="--headless --disable-gpu --no-sandbox --ignore-certificate-errors --disable-dev-shm-usage --allow-insecure-localhost --silent" -v /path/to/your/report:/home/chrome/reports femtopixel/google-lighthouse http://www.google.com --output json