Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Ruff committed Aug 31, 2018
2 parents 662d60d + 9864afd commit 70d61ca
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ cache:
- node_modules
notifications:
email: false
services:
- docker
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.6.0
- export PATH="$HOME/.yarn/bin:$PATH"
Expand All @@ -16,6 +18,8 @@ script:
- yarn lint
after_success:
- yarn release
- docker login -u=$IMMO_DOCKER_USER -p=$IMMO_DOCKER_PASS
- DEBUG=*immowelt* docker-publish --tags=https://api.github.com/repos/ImmoweltGroup/lighthouse-ci/tags --image=immowelt/lighthouse-ci --latest
branches:
except:
- /^v\d+\.\d+\.\d+$/
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM node:8-alpine

RUN echo "http://dl-cdn.alpinelinux.org/alpine/v3.7/community" >> /etc/apk/repositories \
&& echo "http://dl-cdn.alpinelinux.org/alpine/v3.7/main" >> /etc/apk/repositories \
&& apk --no-cache update \
&& apk add --no-cache chromium xvfb bash grep \
&& rm -rf /var/cache/apk/* /tmp/*

ENV CHROME_BIN /usr/bin/chromium-browser
ENV CHROME_PATH /usr/bin/chromium-browser

COPY bin/chromium-xvfb.sh /usr/bin/chromium-xvfb
RUN chmod +x /usr/bin/chromium-xvfb \
&& mv /usr/bin/chromium-browser /usr/bin/chromium \
&& ln -s /usr/bin/chromium-xvfb /usr/bin/chromium-browser

RUN yarn global add @immowelt/lighthouse-ci \
&& mkdir -p /usr/src/app/lighthouse

WORKDIR /usr/src/app/lighthouse-ci

ENTRYPOINT ["lighthouse-ci"]
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,19 @@ For more information use --help
lighthouse-ci --help
```

# Docker

We dockerized this package for a better usability in CI pipelines, you can use it locally like this:
```
docker pull immowelt/lighthouse-ci:latest
docker run -v /path/for/reports:/usr/src/app/lighthouse immowelt/lighthouse-ci:latest https://immowelt.de/ -r
```

> NOTE: If you want to get the generated reports locally, you need to mount a folder directly to container.
# TODOs

* Threshold configuration via config file
* Create node API
* Dockerized images for direct usage in CI pipeline
* ~~Dockerized images for direct usage in CI pipeline~~
* ***Unit tests are missing!***
22 changes: 22 additions & 0 deletions bin/chromium-xvfb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

_kill_chromium_xcfb() {
kill -TERM $chromium
wait $chromium
kill -TERM $xvfb
}

trap _kill_chromium_xcfb SIGTERM

XVFB_WHD=${XVFB_WHD:-1280x720x16}

Xvfb :99 -ac -screen 0 $XVFB_WHD -nolisten tcp &
xvfb=$!

export DISPLAY=:99

chromium --no-sandbox $@ &
chromium=$!

wait $chromium
wait $xvfb

0 comments on commit 70d61ca

Please sign in to comment.