-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
84 lines (64 loc) · 2.04 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
FROM alpine:latest
LABEL description "Run Google Chrome's Lighthouse Audit in the background"
LABEL version="2.0.0"
LABEL author="Matthias Winkelmann <m@matthi.coffee> | Marco Neumann <marco.neumann@invia.de>"
LABEL de.invia.vcs="https://github.com/invia-de/lighthouse-chromium-alpine-docker"
LABEL de.invia.uri="https://www.invia.de"
LABEL coffee.matthi.vcs-url="https://github.com/MatthiasWinkelmann/lighthouse-chromium-alpine-docker"
LABEL coffee.matthi.uri="https://matthi.coffee"
LABEL coffee.matthi.usage="/README.md"
WORKDIR /
USER root
#-----------------
# Set ENV
#-----------------
ENV OUTPUT_PATH /home/lighthouse/output
ENV TZ "Europe/Berlin"
RUN echo $TZ > /etc/timezone
#-----------------
# Add packages
#-----------------
RUN apk -U --no-cache update
RUN apk -U --no-cache add \
zlib-dev \
chromium \
xvfb \
wait4ports \
xorg-server \
dbus \
ttf-freefont \
mesa-dri-swrast \
py2-pip \
npm
# Install lighthouse
RUN npm --global install yarn && yarn global add lighthouse
# Install/Compile Github CLI (needed for github Gists)
RUN apk -U --no-cache add go git make
RUN git clone https://github.com/cli/cli.git gh-cli
RUN cd gh-cli \
&& make \
&& mv ./bin/gh /usr/local/bin
RUN apk del go git make
# Delete Caches
RUN rm -rf /var/lib/apt/lists/* \
/var/cache/apk/* \
/usr/share/man \
/tmp/* \
/usr/lib/node_modules/npm/man \
/usr/lib/node_modules/npm/doc \
/usr/lib/node_modules/npm/html \
/usr/lib/node_modules/npm/scripts
# Add Lighthouse as a user
RUN addgroup lighthouse && adduser -S -g lighthouse lighthouse \
&& mkdir -p /home/lighthouse && mkdir /home/lighthouse/output && chown -R lighthouse:lighthouse /home/lighthouse \
&& mkdir -p /opt/google/lighthouse && chown -R lighthouse:lighthouse /opt/google/lighthouse
# Add Output Volume
VOLUME /home/lighthouse/output
# Run Chrome non-privileged
USER lighthouse
# Set workdir
WORKDIR /home/lighthouse
# Copy needed files
COPY lighthouse-chromium.sh ./
COPY .git-credentials ./
ENTRYPOINT ["./lighthouse-chromium.sh"]