]>
Commit | Line | Data |
---|---|---|
e325e71d | 1 | # A minimal Docker image with Node and Puppeteer |
162d70f3 | 2 | # |
98ecb0ea TL |
3 | # Based upon: |
4 | # https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#running-puppeteer-in-docker | |
162d70f3 | 5 | |
8d456d13 | 6 | FROM node:10.15.3-slim@sha256:5a48598688f771a9140fdef31585dbe67b313b1e29439cbd9b81ebb25aeca517 |
0bbf02d9 | 7 | |
98ecb0ea TL |
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. | |
0bbf02d9 | 13 | # Also install system deps such as make, psmisc to have utily functions (such as fuser, peekfd) |
a035b632 | 14 | && apt-get install -y wget make psmisc git --no-install-recommends \ |
98ecb0ea TL |
15 | && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ |
16 | && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \ | |
17 | && apt-get update \ | |
18 | && apt-get install -y google-chrome-unstable --no-install-recommends \ | |
65cd9245 | 19 | && rm -rf /var/lib/apt/lists/* \ |
f8f84070 | 20 | |
f5311052 PB |
21 | # Tell Puppeteer to skip installing Chrome. We'll be using the installed package. |
22 | # you'll need to launch puppeteer with: | |
23 | # browser.launch({executablePath: 'google-chrome-unstable'}) | |
24 | ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true | |
25 | ||
f8f84070 TL |
26 | # Install Puppeteer under /node_modules so it's available system-wide |
27 | ADD package.json package-lock.json / | |
65cd9245 | 28 | RUN npm install |
f5311052 PB |
29 | |
30 | # Add user so we don't need --no-sandbox. | |
31 | RUN groupadd -r pptruser && useradd -r -g pptruser -G audio,video pptruser \ | |
32 | && mkdir -p /home/pptruser/Downloads \ | |
33 | && chown -R pptruser:pptruser /home/pptruser \ | |
34 | && chown -R pptruser:pptruser /node_modules | |
35 | ||
36 | # Run everything after as non-privileged user. | |
37 | USER pptruser |