From f5311052e52ca898602cdae2c61ae1891768283c Mon Sep 17 00:00:00 2001 From: Paul Bonaud Date: Fri, 8 Feb 2019 12:02:19 +0100 Subject: don't download chrome twice. Use the system installed one --- Dockerfile | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index fe9f105..af1e706 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ # https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#running-puppeteer-in-docker FROM node:10.15.1-slim@sha256:f584009b47eb352e7ae0a550fb9394533dc9b80f7aa83d50ef81657358412d0e - + RUN apt-get update \ # See https://crbug.com/795759 && apt-get install -yq libgconf-2-4 \ @@ -19,6 +19,20 @@ RUN apt-get update \ && wget --quiet https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh -O /usr/sbin/wait-for-it.sh \ && chmod +x /usr/sbin/wait-for-it.sh +# Tell Puppeteer to skip installing Chrome. We'll be using the installed package. +# you'll need to launch puppeteer with: +# browser.launch({executablePath: 'google-chrome-unstable'}) +ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true + # Install Puppeteer under /node_modules so it's available system-wide ADD package.json package-lock.json / RUN npm install + +# Add user so we don't need --no-sandbox. +RUN groupadd -r pptruser && useradd -r -g pptruser -G audio,video pptruser \ + && mkdir -p /home/pptruser/Downloads \ + && chown -R pptruser:pptruser /home/pptruser \ + && chown -R pptruser:pptruser /node_modules + +# Run everything after as non-privileged user. +USER pptruser -- cgit v1.2.3