A simple service for capturing rendered Web pages using puppeteer.
Ased as a companion service for data-fair.
To run locally you will need to install google-chrome-unstable for your system.
Install dependencies without downloading chromium:
export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
npm i
Then start the server:
npm run dev
Or build and run the docker image:
docker buildx build -t capture --progress plain --load . && docker run --rm -it --security-opt seccomp=$(pwd)/seccomp.json -p 5607:5607 -p 9090:9090 -e DEBUG=capture,timer -e ONLY_SAME_HOST=false -e PORT=5607 --name capture capture
Check the service with these examples:
- simple screenshot
- custom size
- custom lang
- custom timezone
- download with custom filename
- simple pdf print
- simple HTML print
- animated gif screenshot
- animated gif screenshot with custom filename
- fallback to standard screenshot with custom filename
- screenshot converted to jpg
- screenshot with custom jpg filename
- remote url with a webgl based map
Consider reading this article https://github.com/Zenika/alpine-chrome#3-ways-to-securely-use-chrome-headless-with-this-image
We recommend using ./seccomp.json. If you trust all pages opened by capture you can use PUPPETEER_ARGS=["--no-sandbox"] environment variable.