]> git.immae.eu Git - github/fretlink/docker-puppeteer.git/blob - Dockerfile
af1e706382684093a595302926389bd3bba48532
[github/fretlink/docker-puppeteer.git] / Dockerfile
1 # A minimal Docker image with Node and Puppeteer
2 #
3 # Based upon:
4 # https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#running-puppeteer-in-docker
5
6 FROM node:10.15.1-slim@sha256:f584009b47eb352e7ae0a550fb9394533dc9b80f7aa83d50ef81657358412d0e
7
8 RUN apt-get update \
9 # See https://crbug.com/795759
10 && apt-get install -yq libgconf-2-4 \
11 # Install latest chrome dev package, which installs the necessary libs to
12 # make the bundled version of Chromium that Puppeteer installs work.
13 && apt-get install -y wget make --no-install-recommends \
14 && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
15 && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
16 && apt-get update \
17 && apt-get install -y google-chrome-unstable --no-install-recommends \
18 && rm -rf /var/lib/apt/lists/* \
19 && wget --quiet https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh -O /usr/sbin/wait-for-it.sh \
20 && chmod +x /usr/sbin/wait-for-it.sh
21
22 # Tell Puppeteer to skip installing Chrome. We'll be using the installed package.
23 # you'll need to launch puppeteer with:
24 # browser.launch({executablePath: 'google-chrome-unstable'})
25 ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
26
27 # Install Puppeteer under /node_modules so it's available system-wide
28 ADD package.json package-lock.json /
29 RUN npm install
30
31 # Add user so we don't need --no-sandbox.
32 RUN groupadd -r pptruser && useradd -r -g pptruser -G audio,video pptruser \
33 && mkdir -p /home/pptruser/Downloads \
34 && chown -R pptruser:pptruser /home/pptruser \
35 && chown -R pptruser:pptruser /node_modules
36
37 # Run everything after as non-privileged user.
38 USER pptruser