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

DEVOPS-1181 lighthouse integration #521

Merged
merged 9 commits into from
Jan 14, 2021
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
lighthouse:
build: .my127ws/docker/image/lighthouse
environment:
TARGET_URL: "{{ @('lighthouse.target.url') | raw }}"
{% if @('app.build') == 'dynamic' %}
volumes:
- ./app:/app
{% endif %}
23 changes: 23 additions & 0 deletions src/_base/docker/image/lighthouse/Dockerfile.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM yukinying/chrome-headless-browser:latest

USER root

RUN apt update
RUN apt install -y npm
RUN npm install -g n
# upgrade nodejs to latest version for lighthouse
RUN n latest
RUN npm install -g lighthouse

{% if @('app.build') == 'static' %}
COPY root /
RUN chown headless /app/run.sh
RUN chmod u+x /app/run.sh
{% else %}
VOLUME /app
{% endif %}

USER headless

ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["/app/run.sh"]
11 changes: 11 additions & 0 deletions src/_base/docker/image/lighthouse/root/app/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
set -e -o pipefail

reportDir="/home/headless/results"

mkdir -p "${reportDir}"

lighthouse --no-enable-error-reporting \
--chrome-flags="--headless --no-sandbox=true" \
--output-path=/home/headless/results/lighthouse-results.html \
"${TARGET_URL}"
4 changes: 4 additions & 0 deletions src/_base/harness/attributes/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ attributes.default:
default_branch: = @('git.main_branch')
# potentially deprecated, unless it is repurposed
main_branch: develop

lighthouse:
target:
url: ~

nginx:
# used to set site specific configurations under server directive
Expand Down
5 changes: 5 additions & 0 deletions src/_base/harness/config/commands.yml
Original file line number Diff line number Diff line change
Expand Up @@ -327,3 +327,8 @@ command('generate token <length>'):
$string .= $char;
}
echo $string;

command('lighthouse'):
exec: |
#!bash(workspace:/)|@
passthru docker-compose run --rm lighthouse
1 change: 1 addition & 0 deletions src/_base/harness/config/confd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ confd('harness:/'):
- { src: docker/image/console/root/usr/local/etc/php/conf.d/docker-php-ext-blackfire.ini }
- { src: docker/image/console/root/usr/local/etc/php/conf.d/docker-php-ext-tideways.ini }
- { src: docker/image/console/root/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini }
- { src: docker/image/lighthouse/Dockerfile }
- { src: docker/image/nginx/Dockerfile }
- { src: docker/image/nginx/root/docker-entrypoint.d/config_render.sh }
- { src: docker/image/nginx/root/etc/nginx/conf.d/0-nginx.conf }
Expand Down