Skip to content

Commit 788b423

Browse files
committed
fixes #8 - add --no-sandbox default chrome flag + possibility to pass CHROME_FLAGS env
1 parent 6bbc304 commit 788b423

File tree

5 files changed

+15
-7
lines changed

5 files changed

+15
-7
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ If you find this useful, please consider starring the repo and/or donating.
1818
People showing interest attract more attention ;)
1919
-->
2020

21+
**Output of `docker inspect lighthouse --format='{{index .Config.Labels.version}}'`:**
22+
23+
```
24+
(paste your output here)
25+
```
26+
2127
**Description**
2228

2329
<!--
@@ -46,9 +52,3 @@ Briefly describe the problem you are having in a few paragraphs.
4652
(paste logs)
4753
</pre>
4854
</details>
49-
50-
**Output of `docker inspect lighthouse --format='{{index .Config.Labels.version}}'`:**
51-
52-
```
53-
(paste your output here)
54-
```

Dockerfile.amd64

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ COPY entrypoint.sh /usr/bin/entrypoint
3030
# Run Chrome non-privileged
3131
USER chrome
3232

33+
ENV CHROME_FLAGS="--headless --disable-gpu --no-sandbox"
34+
3335
VOLUME /home/chrome/reports
3436

3537
# Drop to cli

Dockerfile.arm32v7

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ COPY entrypoint.sh /usr/bin/entrypoint
3535
# Run Chrome non-privileged
3636
USER chrome
3737

38+
ENV CHROME_FLAGS="--headless --disable-gpu --no-sandbox"
39+
3840
VOLUME /home/chrome/reports
3941

4042
# Drop to cli

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ For example, you can export as json with this command:
3030
docker run --rm --name lighthouse -it -v /path/to/your/report:/home/chrome/reports --cap-add=SYS_ADMIN femtopixel/google-lighthouse http://www.google.com --output json
3131
```
3232

33+
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`)
34+
3335
Further reading on [Google Lighthouse](https://github.com/GoogleChrome/lighthouse#using-programmatically)
3436

3537
Usage : Improved

entrypoint.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#!/bin/sh
22
set -e
33

4+
CHROME_FLAGS=${CHROME_FLAGS:-"--headless --disable-gpu --no-sandbox"}
5+
46
# first arg is `-f` or `--some-option`
57
if [ "${1#http}" != "$1" ]; then
6-
set -- lighthouse --enable-error-reporting --chrome-flags="--headless --disable-gpu" "$@"
8+
set -- lighthouse --enable-error-reporting --chrome-flags="${CHROME_FLAGS}" "$@"
79
fi
810

911
exec "$@"

0 commit comments

Comments
 (0)