Skip to content

Instantly share code, notes, and snippets.

@lpellegr
Forked from tnolet/Dockerfile
Created September 14, 2018 22:02
Show Gist options
  • Save lpellegr/0bd4904142705ccccebd0467fc571b9d to your computer and use it in GitHub Desktop.
Save lpellegr/0bd4904142705ccccebd0467fc571b9d 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