Created
January 16, 2024 07:56
-
-
Save samjarman/0ec51181700e7734d9b80c6a4fb272b9 to your computer and use it in GitHub Desktop.
Puppeteer in docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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