aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTim Lucas <t@toolmantim.com>2018-03-15 23:57:03 +1100
committerTim Lucas <t@toolmantim.com>2018-03-15 23:57:03 +1100
commit162d70f3784124050ac7c705cecb4e395733642e (patch)
treeb6028002f4bb8ea3b1c1923324446380b0e765b3
parent7e5d7caa2a4ce3cdb97cb3b859e252c75726d5ae (diff)
downloaddocker-puppeteer-162d70f3784124050ac7c705cecb4e395733642e.tar.gz
docker-puppeteer-162d70f3784124050ac7c705cecb4e395733642e.tar.zst
docker-puppeteer-162d70f3784124050ac7c705cecb4e395733642e.zip
Initial commit
-rw-r--r--Dockerfile47
-rw-r--r--README18
2 files changed, 65 insertions, 0 deletions
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..0e46b41
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,47 @@
1# Copy and pasted from:
2# https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#running-puppeteer-in-docker
3#
4# The only change is locking it down to a specific version of Puppeteer in the
5# `npm install` line.
6
7FROM node:8-slim
8
9# See https://crbug.com/795759
10RUN apt-get update && apt-get install -yq libgconf-2-4
11
12# Install latest chrome dev package and fonts to support major charsets (Chinese, Japanese, Arabic, Hebrew, Thai and a few others)
13# Note: this installs the necessary libs to make the bundled version of Chromium that Puppeteer
14# installs, work.
15RUN apt-get update && apt-get install -y wget --no-install-recommends \
16 && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
17 && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
18 && apt-get update \
19 && apt-get install -y google-chrome-unstable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst ttf-freefont \
20 --no-install-recommends \
21 && rm -rf /var/lib/apt/lists/* \
22 && apt-get purge --auto-remove -y curl \
23 && rm -rf /src/*.deb
24
25# It's a good idea to use dumb-init to help prevent zombie chrome processes.
26ADD https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64 /usr/local/bin/dumb-init
27RUN chmod +x /usr/local/bin/dumb-init
28
29# Uncomment to skip the chromium download when installing puppeteer. If you do,
30# you'll need to launch puppeteer with:
31# browser.launch({executablePath: 'google-chrome-unstable'})
32# ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
33
34# Install puppeteer so it's available in the container.
35RUN npm i puppeteer@1.1.1
36
37# Add user so we don't need --no-sandbox.
38RUN groupadd -r pptruser && useradd -r -g pptruser -G audio,video pptruser \
39 && mkdir -p /home/pptruser/Downloads \
40 && chown -R pptruser:pptruser /home/pptruser \
41 && chown -R pptruser:pptruser /node_modules
42
43# Run everything after as non-privileged user.
44USER pptruser
45
46ENTRYPOINT ["dumb-init", "--"]
47CMD ["google-chrome-unstable"] \ No newline at end of file
diff --git a/README b/README
new file mode 100644
index 0000000..b58eff5
--- /dev/null
+++ b/README
@@ -0,0 +1,18 @@
1# Docker Puppeteer
2
3A Puppeteer Docker image based on the code here (Apache 2.0 license):
4https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#running-puppeteer-in-docker
5
6An example for how to use:
7
8```Dockerfile
9FROM buildkite/puppeteer
10
11RUN npm install mocha
12ENV PATH="${PATH}:/node_modules/.bin"
13
14# The `tests` dir is expected to be mounted into here
15WORK_DIR /home/pptr
16
17CMD ["mocha", "--recursive", "tests"]
18``` \ No newline at end of file