Skip to content
This repository has been archived by the owner on Jan 19, 2023. It is now read-only.

giantswarm/lighthouse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Docker Repository on Quay

lighthouse

Chrome Lighthouse in Docker, plus a few utilities useful for CI.

Usage

Run lighthouse with headless Chrome

docker run --rm \
    -v $PWD:/out \
    -v $PWD/dev-shm:/dev/shm \
    quay.io/giantswarm/lighthouse \
    lighthouse \
    http://example.com/ \
        --no-enable-error-reporting \
        --output=json \
        --output-path=/out/lighthouse.json \
        --emulated-form-factor desktop \
        --plugins=lighthouse-plugin-greenhouse \
        --chrome-flags="--headless --no-sandbox"

This should result in a lighthouse.json file being generated in your directory.

Mounting a volume to /dev/shm is recommended to prevent the process from dying for a lack of available shared memory.

For a list of options for --chrome-flags, check out this huge list.

For a list of lighthouse flags, execute

docker run --rm \
    -v $PWD/dev-shm:/dev/shm \
    quay.io/giantswarm/lighthouse --help

Run lighthouse-ci

This is a useful way to execute lighthouse in CI and fail if the score is below a threshold. See andreasonny83/lighthouse-ci for details.

docker run --rm \
    -v $PWD:/out \
    -v $PWD/dev-shm:/dev/shm \
    quay.io/giantswarm/lighthouse \
    lighthouse-ci \
    http://example.com/ \
        --report=/out \
        --score=90 \
        --emulated-form-factor desktop \
        --chrome-flags="--headless --no-sandbox"

The --score=90 flag sets a threshold score to pass of 90 in this case. Check lighthouse-ci for more flags.

Run lighthouse-keeper

This allows to run lighthouse in CI for a GitHub pull request and comment back the result. See giantswarm/lighthouse-keeper for details.

compare two lighthouse reports

docker run --rm \
    -v $PWD:/workdir -w /workdir \
    quay.io/giantswarm/lighthouse \
    lighthouse-keeper compare \
      --input master.json --label master \
      --input thisbranch.json --label "this branch"