Debian Codegraph @

infra/lottiecap/docker/lottie-web-puppeteer/Dockerfile

raw
1 # Docker container with Google Chrome and puppeteer.
2 #
3 # Tests will be run as non-root (user skia, in fact), so /OUT should have permissions
4 # 777 so as to be able to create output there.
5
6 FROM node:8.11
7
8 RUN apt-get update && apt-get upgrade -y
9
10 RUN wget https://github.com/Yelp/dumb-init/releases/download/v1.2.2/dumb-init_1.2.2_amd64.deb
11 RUN dpkg -i dumb-init_*.deb
12
13 # https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#running-puppeteer-in-docker
14 # recommends using dumb-init to "prevent zombie chrome processes"
15 ENTRYPOINT ["/usr/bin/dumb-init", "--"]
16
17 RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
18 RUN sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
19 RUN apt-get update && apt-get install -y google-chrome-stable
20
21 ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
22
23 RUN npm install --global \
24 [email protected] \
25 [email protected] \
26 [email protected] \
27 [email protected] \
28 [email protected]
29
30 # Allows require('puppeteer') to work from anywhere.
31 # https://stackoverflow.com/a/15646750
32 ENV NODE_PATH=/usr/local/lib/node_modules
33
34 #Add user so we don't have to run as root (prevents us from over-writing files in /SRC)
35 RUN groupadd -g 2000 skia \
36 && useradd -u 2000 -g 2000 skia \
37 && mkdir -p /home/skia \
38 && chown -R skia:skia /home/skia
39
40 # These directories can be used for mounting a source checkout and having a place to put outputs.
41 RUN mkdir -m 0777 /SRC /OUT
42
43 # Run everything after as non-privileged user.
44 USER skia
45
46 WORKDIR /home/skia