├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE.md └── workflows │ └── main.yml ├── .gitignore ├── CONTRIBUTING.md ├── Dockerfile ├── LICENSE.md ├── Makefile ├── README.md ├── entrypoint.sh └── logo.png /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: jaymoulin # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: ['https://www.paypal.me/jaymoulin', 'https://www.buymeacoffee.com/jaymoulin', 'https://www.tipeeestream.com/cursedware/donation', 'https://streamlabs.com/cursedware/tip'] 13 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 23 | 24 | **Output of `docker inspect lighthouse --format='{{index .Config.Labels.version}}'`:** 25 | 26 | ``` 27 | (paste your output here) 28 | ``` 29 | 30 | **Description** 31 | 32 | 35 | 36 | **Command line I used to start the container** 37 | 38 | **Steps to reproduce the issue:** 39 | 1. 40 | 2. 41 | 3. 42 | 43 | **Describe the results you received:** 44 | 45 | 46 | **Describe the results you expected:** 47 | 48 | 49 | **Additional information you deem important (e.g. issue happens only occasionally):** 50 | 51 | **Provide some logs (`docker logs lighthouse`)** 52 | 53 |
54 |
55 | (paste logs)
56 | 
57 |
58 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | 8 | jobs: 9 | build: 10 | 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - uses: actions/checkout@v1 15 | - name: Installing dependencies 16 | run: | 17 | sudo apt update && sudo apt install make -y 18 | echo "${{ secrets.DOCKER_HUB_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_HUB_LOGIN }}" --password-stdin 19 | - name: Build image 20 | run: make build 21 | - name: Publish image 22 | run: make publish latest 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .build 2 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | How to Contribute 2 | ================= 3 | 4 | This project welcomes your contribution. There are several ways to help out: 5 | 6 | * Create an [issue](https://github.com/femtopixel/docker-google-lighthouse/issues/) on GitHub, 7 | if you have found a bug or have an idea for a feature 8 | * Write test cases for open bug issues 9 | * Write patches for open bug/feature issues 10 | 11 | There are a few guidelines that we need contributors to follow, so that we have a 12 | chance of keeping on top of things. 13 | 14 | Issues 15 | ------ 16 | 17 | * Submit an [issue](https://github.com/femtopixel/docker-google-lighthouse/issues/) 18 | * Make sure it does not already exist. 19 | * Clearly describe the issue including steps to reproduce, when it is a bug. 20 | * Make sure you note the version you use. 21 | 22 | Additional Resources 23 | -------------------- 24 | 25 | * [Existing issues](https://github.com/femtopixel/docker-google-lighthouse/issues/) 26 | * [General GitHub documentation](https://help.github.com/) 27 | * [GitHub pull request documentation](https://help.github.com/send-pull-requests/) 28 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM femtopixel/google-chrome-headless 2 | 3 | ARG VERSION=v12.6.1 4 | 5 | LABEL maintainer="Jay MOULIN " 6 | LABEL version="${VERSION}" 7 | 8 | USER root 9 | 10 | # Install deps + add Chrome Stable + purge all the things 11 | RUN rm -rf /var/lib/apt/lists/* && \ 12 | apt-get update && \ 13 | apt-get remove gnupg -y && apt-get install --reinstall gnupg2 dirmngr --allow-unauthenticated -y && \ 14 | apt-get autoclean && apt-get update && apt-get install -y apt-transport-https ca-certificates curl gnupg git --no-install-recommends && \ 15 | curl -sSL https://deb.nodesource.com/setup_20.x | bash - && \ 16 | apt-get install -y nodejs --no-install-recommends && \ 17 | npm --global install npm && \ 18 | npm --global install yarn && \ 19 | rm -rf /var/lib/apt/lists/* && \ 20 | npm install --global lighthouse && \ 21 | apt-get purge --auto-remove -y curl gnupg git && \ 22 | mkdir -p /home/chrome/reports && chown -R chrome:chrome /home/chrome 23 | 24 | # some place we can mount and view lighthouse reports 25 | VOLUME /home/chrome/reports 26 | WORKDIR /home/chrome/reports 27 | 28 | COPY entrypoint.sh /usr/bin/entrypoint 29 | 30 | # Run Chrome non-privileged 31 | USER chrome 32 | 33 | ENV CHROME_FLAGS="--headless --disable-gpu --no-sandbox" 34 | 35 | VOLUME /home/chrome/reports 36 | 37 | # Drop to cli 38 | ENTRYPOINT ["entrypoint"] 39 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | Copyright (c) 2017 FemtoPixel 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 5 | 6 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 7 | 8 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 9 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | CACHE ?= --no-cache=1 2 | VERSION ?= v12.6.1 3 | .PHONY: all build publish latest 4 | all: build publish 5 | build: 6 | docker build -t femtopixel/google-lighthouse:${VERSION} -t femtopixel/google-lighthouse --build-arg VERSION=${VERSION} ${CACHE} . 7 | publish: 8 | docker push femtopixel/google-lighthouse -a 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | > [!CAUTION] 2 | > 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. 3 | 4 | > [!NOTE] 5 | > (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.) 6 | 7 | > [!TIP] 8 | > THIS REPOSITORY IS AUTO-UPDATED BY [GITHUB-RELEASE-NOTIFIER](https://github.com/femtopixel/github-release-notifier) (https://github.com/femtopixel/github-release-notifier) 9 | 10 | ![logo](logo.png) 11 | 12 | Google Lighthouse - Docker Image 13 | ================================ 14 | 15 | [![latest release](https://img.shields.io/github/release/femtopixel/docker-google-lighthouse.svg "latest release")](http://github.com/femtopixel/docker-google-lighthouse/releases) 16 | [![Docker Pulls](https://img.shields.io/docker/pulls/femtopixel/google-lighthouse.svg)](https://hub.docker.com/r/femtopixel/google-lighthouse/) 17 | [![Docker Stars](https://img.shields.io/docker/stars/femtopixel/google-lighthouse.svg)](https://hub.docker.com/r/femtopixel/google-lighthouse/) 18 | [![PayPal donation](https://github.com/jaymoulin/jaymoulin.github.io/raw/master/ppl.png "PayPal donation")](https://www.paypal.me/jaymoulin) 19 | [![Buy me a coffee](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png "Buy me a coffee")](https://www.buymeacoffee.com/jaymoulin) 20 | [![Buy me a coffee](https://ko-fi.com/img/githubbutton_sm.svg "Buy me a coffee")](https://www.ko-fi.com/jaymoulin) 21 | 22 | [Lighthouse](https://developers.google.com/web/tools/lighthouse/) analyzes web apps and web pages, collecting modern performance metrics and insights on developer best practices. 23 | 24 | This image is greatly inspired from [Justin RIBEIRO's work](https://github.com/justinribeiro/dockerfiles/tree/master/lighthouse) 25 | 26 | Usage 27 | ----- 28 | 29 | ``` 30 | docker run --rm --name lighthouse -it -v /path/to/your/report:/home/chrome/reports femtopixel/google-lighthouse 31 | ``` 32 | 33 | With `` url to your site (e.g. http://www.google.com). You can pass args **AFTER** the `url` if you want to. 34 | 35 | For example, you can export as json with this command: 36 | 37 | ``` 38 | docker run --rm --name lighthouse -it -v /path/to/your/report:/home/chrome/reports femtopixel/google-lighthouse http://www.google.com --output json 39 | ``` 40 | 41 | 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`) 42 | 43 | Further reading on [Google Lighthouse](https://github.com/GoogleChrome/lighthouse/blob/master/docs/readme.md#using-programmatically) 44 | 45 | FAQ 46 | --- 47 | 48 | * Error while writing files 49 | ``` 50 | Runtime error encountered: { Error: EACCES: permission denied, open '/home/chrome/reports/myawesome_site_admin_heavypage.report.json' 51 | errno: -13, 52 | code: 'EACCES', 53 | syscall: 'open', 54 | path: '/home/chrome/reports/myawesome_site_admin_heavypage.report.json' } 55 | ``` 56 | Make sure your folder has the write right for others (chmod o+w) 57 | 58 | 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) 59 | 60 | 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` 61 | -------------------------------------------------------------------------------- /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | CHROME_FLAGS=${CHROME_FLAGS:-"--headless --disable-gpu --no-sandbox"} 5 | 6 | # first arg is `-f` or `--some-option` 7 | if [ "${1#http}" != "$1" ]; then 8 | set -- lighthouse --enable-error-reporting --chrome-flags="${CHROME_FLAGS}" "$@" 9 | fi 10 | 11 | exec "$@" 12 | -------------------------------------------------------------------------------- /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/femtopixel/docker-google-lighthouse/97a2a8b81a2e935ec45d77c12ac844fef68fd8b4/logo.png --------------------------------------------------------------------------------