]> git.immae.eu Git - github/fretlink/docker-puppeteer.git/commitdiff
don't download chrome twice. Use the system installed one v1.12.3
authorPaul Bonaud <paul.bonaud@fretlink.com>
Fri, 8 Feb 2019 11:02:19 +0000 (12:02 +0100)
committerPaul Bonaud <paul.bonaud@fretlink.com>
Fri, 8 Feb 2019 11:02:19 +0000 (12:02 +0100)
Dockerfile

index fe9f1057c1b29eff85771f12fb7a59aa5fa17482..af1e706382684093a595302926389bd3bba48532 100644 (file)
@@ -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