puppeteer/docker
Alex Rudenko 936ed8607e feat: add Dockerfile (#8315)
This PR adds an official Dockerfile for Puppeteer. The content of the Dockerfile is practically the same as documented in troubleshooting.md:

1) It installs chrome-stable and dependencies via apt-get.
2) it installs a local Puppeteer build into the docker user's home folder.
3) configures required permissions for the user.
4) outputs licenses into the THIRD_PARTY_NOTICES file.

The local Puppeteer build is created by `docker/pack.sh` which is meant to be used in CI. This PR also includes a GitHub action that would build a docker image and run a smote test inside of it.

The next step would be actually publishing the docker image from GitHub Actions to GitHub Registry.
2022-08-02 13:18:47 +00:00
..
test feat: add Dockerfile (#8315) 2022-08-02 13:18:47 +00:00
Dockerfile feat: add Dockerfile (#8315) 2022-08-02 13:18:47 +00:00
pack.sh feat: add Dockerfile (#8315) 2022-08-02 13:18:47 +00:00
README.md feat: add Dockerfile (#8315) 2022-08-02 13:18:47 +00:00

Dockerfile for Puppeteer

This directory contains files needed to containerize Puppeteer. The major problem that this is solving is the problem of providing all dependencies required to run a browser instance.

Building the image

docker build -t puppeteer-chrome-linux . # `puppeteer-chrome-linux` is the name of the image.

Running the image

docker run -i --init --rm --cap-add=SYS_ADMIN --name puppeteer-chrome puppeteer-chrome-linux node -e "`cat test.js`"

--cap-add=SYS_ADMIN capability is needed to enable Chromium sandbox that makes the browser more secure. Alternatively, it should be possible to start the browser binary with the --no-sandbox flag.