Skip to content

Instantly share code, notes, and snippets.

@toolmantim
Created June 16, 2022 07:57
Show Gist options
  • Save toolmantim/d44f6b1be63a3c31f4e69721ff718a57 to your computer and use it in GitHub Desktop.
Save toolmantim/d44f6b1be63a3c31f4e69721ff718a57 to your computer and use it in GitHub Desktop.
# A minimal Docker image with Node and Puppeteer
#
# Initially based upon:
# https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#running-puppeteer-in-docker
FROM node:16.15.1-buster-slim@sha256:3c8acd4934617f60dad7e4cc941faa064aa5a14da437dc156bdcad9d4a67bc4e as puppeteer
RUN apt-get update \
&& apt-get install -y wget gnupg ca-certificates procps libxss1 git \
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get update \
# We install Chrome to get all the OS level dependencies, but Chrome itself
# is not actually used as it's packaged in the node puppeteer library.
# Alternatively, we could could include the entire dep list ourselves
# (https://github.com/puppeteer/puppeteer/blob/master/docs/troubleshooting.md#chrome-headless-doesnt-launch-on-unix)
# but that seems too easy to get out of date.
&& apt-get install -y google-chrome-stable \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY package.json yarn.lock .yarnclean /app/
RUN yarn install --frozen-lockfile --silent --production=false
COPY . /app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment