-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
61 lines (49 loc) · 1.67 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
# Base docker image
FROM debian:stretch-slim
LABEL name="chrome-headless" \
maintainer="Justin Ribeiro <[email protected]>" \
version="2.0" \
description="Google Chrome Headless in a container"
# Install deps + add Chrome Stable + purge all the things
RUN apt-get update && apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg \
--no-install-recommends \
&& curl -sSL https://dl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& echo "deb https://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list \
&& apt-get update && apt-get install -y \
google-chrome-stable \
fontconfig \
fonts-ipafont-gothic \
fonts-wqy-zenhei \
fonts-thai-tlwg \
fonts-kacst \
fonts-symbola \
fonts-noto \
ttf-freefont \
--no-install-recommends \
&& curl -sL https://deb.nodesource.com/setup_10.x | bash - \
&& apt-get install -y nodejs \
&& apt-get purge --auto-remove -y curl gnupg \
&& rm -rf /var/lib/apt/lists/*
# Add Chrome as a user
RUN groupadd -r chrome && useradd -r -g chrome -G audio,video chrome \
&& mkdir -p /home/chrome && chown -R chrome:chrome /home/chrome \
&& mkdir -p /opt/google/chrome && chown -R chrome:chrome /opt/google/chrome \
&& mkdir -p /home/chrome/reports && chown -R chrome:chrome /home/chrome
# Setup Express server
WORKDIR /usr/src/app
COPY ./app/ /usr/src/app/
RUN npm install --unsafe-perm
WORKDIR /home/chrome/reports
# Run Chrome non-privileged
USER chrome
VOLUME /home/chrome/reports
ENV REPORTS_PATH="/home/chrome/reports/"
# Drop to cli
#ENTRYPOINT ["entrypoint"]
#RUN node /usr/src/app/app.js &
CMD [ "node", "/usr/src/app/start.js" ]
#CMD ["bash"]