Skip to content

Instantly share code, notes, and snippets.

@tnolet
Created January 19, 2018 15:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tnolet/60393c83d7083e1c39a5fb6f608124cb to your computer and use it in GitHub Desktop.
Save tnolet/60393c83d7083e1c39a5fb6f608124cb to your computer and use it in GitHub Desktop.
A Dockerfile for running Puppeteer. Used for https://trypuppeteer.com. Scraped together from various sources. Works well with Puppeteer 1.0.0
FROM ubuntu:16.04
# Create a user so our program doesn't run as root.
RUN mkdir -p /home/chrome/
RUN groupadd -r chrome &&\
useradd -r -g chrome -d /home/chrome -s /sbin/nologin -G audio,video chrome
ENV HOME=/home/chrome
ENV NODE_ENV=production
ENV FONT_DIR=/usr/share/fonts/noto
ENV CONNECTION_TIMEOUT=60000
ENV CHROME_PATH=/usr/bin/google-chrome
RUN mkdir -p $FONT_DIR
WORKDIR $HOME
RUN apt-get update && apt-get install -y \
wget \
unzip \
fontconfig \
locales \
gconf-service \
libasound2 \
libatk1.0-0 \
libc6 \
libcairo2 \
libcups2 \
libdbus-1-3 \
libexpat1 \
libfontconfig1 \
libgcc1 \
libgconf-2-4 \
libgdk-pixbuf2.0-0 \
libglib2.0-0 \
libgtk-3-0 \
libnspr4 \
libpango-1.0-0 \
libpangocairo-1.0-0 \
libstdc++6 \
libx11-6 \
libx11-xcb1 \
libxcb1 \
libxcomposite1 \
libxcursor1 \
libxdamage1 \
libxext6 \
libxfixes3 \
libxi6 \
libxrandr2 \
libxrender1 \
libxss1 \
libxtst6 \
ca-certificates \
fonts-liberation \
libappindicator1 \
libnss3 \
lsb-release \
xdg-utils
# Install Node.js
RUN apt-get install --yes curl &&\
curl --silent --location https://deb.nodesource.com/setup_8.x | bash - &&\
apt-get install --yes nodejs &&\
apt-get install --yes build-essential
# Install emoji's
RUN cd $font_directory &&\
wget https://github.com/emojione/emojione-assets/releases/download/3.1.2/emojione-android.ttf &&\
fc-cache -f -v
COPY package.json .
RUN npm install
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN chown -R chrome:chrome $HOME
USER chrome
RUN mkdir -p /home/chrome/run/
COPY index.js .
ENTRYPOINT [ "node", "index.js" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment