Use a docker image to support puppeteer (#7)

This commit is contained in:
Simon Lecoq
2020-10-26 13:22:51 +01:00
committed by GitHub
parent 198fd7db67
commit 8baedc87a7
11 changed files with 94595 additions and 47 deletions

25
Dockerfile Normal file
View File

@@ -0,0 +1,25 @@
# Based on https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#running-puppeteer-in-docker
# Base image
FROM node:15-slim
# Install latest chrome dev package and fonts to support major charsets
RUN apt-get update \
&& apt-get install -y wget gnupg ca-certificates libgconf-2-4 \
&& 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 \
&& apt-get install -y google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
# Uncomment to skip the chromium download when installing puppeteer
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
ENV PUPPETEER_BROWSER_PATH "google-chrome-stable"
# Copy action
COPY action/dist/index.js /index.js
RUN chmod +x /index.js
# Execute action
ENTRYPOINT node /index.js