Skip to content

Instantly share code, notes, and snippets.

@samjarman
Created January 16, 2024 07:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samjarman/0ec51181700e7734d9b80c6a4fb272b9 to your computer and use it in GitHub Desktop.
Save samjarman/0ec51181700e7734d9b80c6a4fb272b9 to your computer and use it in GitHub Desktop.
Puppeteer in docker
# Adapted From: https://github.com/puppeteer/puppeteer/blob/main/docker/Dockerfile
# Worked with V15
FROM node:18.12.0-slim
# FROM ghcr.io/puppeteer/puppeteer:16.1.0
# Install latest chrome dev package and fonts to support major charsets (Chinese, Japanese, Arabic, Hebrew, Thai and a few others)
# Note: this installs the necessary libs to make the bundled version of Chromium that Puppeteer
# installs, work.
RUN apt-get update \
&& apt-get install -y wget gnupg \
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor -o /usr/share/keyrings/googlechrome-linux-keyring.gpg \
&& sh -c 'echo "deb [arch=amd64 signed-by=/usr/share/keyrings/googlechrome-linux-keyring.gpg] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get update \
&& apt-get install -y google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-khmeros fonts-kacst fonts-freefont-ttf libxss1 \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/* \
&& groupadd -r pptruser && useradd -rm -g pptruser -G audio,video pptruser
USER pptruser
WORKDIR /home/pptruser
RUN npm i puppeteer \
&& (node -e "require('child_process').execSync(require('puppeteer').executablePath() + ' --credits', {stdio: 'inherit'})" > THIRD_PARTY_NOTICES)
CMD ["google-chrome-stable"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment