theohbrothers / docker-html-pdf-chrome

Dockerized html-pdf-chrome, with headless chromium running in the background 🐳

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

docker-html-pdf-chrome

github-actions github-release docker-image-size

Dockerized html-pdf-chrome, with headless chromium running in the background.

Tags

Tag Dockerfile Build Context
:0.8.4, :latest View
  • All images are based on alpine, and include node and npm

Usage

To export a remote HTML page as .pdf:

docker run --rm -it -e URL=http://localhost -e PDF_FILE=export.pdf -v $(pwd):$(pwd) -w $(pwd) --network host theohbrothers/docker-html-pdf-chrome:0.8.4
docker run --rm -it -e URL=https://example.com -e PDF_FILE=export.pdf -v $(pwd):$(pwd) -w $(pwd) theohbrothers/docker-html-pdf-chrome:0.8.4

For export more complex cases, mount your custom script as /export.js:

docker run --rm -it -v $(pwd)/export.js:/export.js -v $(pwd):$(pwd) -w $(pwd) theohbrothers/docker-html-pdf-chrome:0.8.4 node /export.js

For a sleeping container (to reduce overhead of restarting chromium every run):

docker run --rm -it -e SLEEP=1 -v $(pwd):$(pwd) -w $(pwd) theohbrothers/docker-html-pdf-chrome:0.8.4

See html-pdf-chrome usage.

Development

Requires Windows powershell or pwsh.

# Install Generate-DockerImageVariants module: https://github.com/theohbrothers/Generate-DockerImageVariants
Install-Module -Name Generate-DockerImageVariants -Repository PSGallery -Scope CurrentUser -Force -Verbose

# Edit ./generate templates

# Generate the variants
Generate-DockerImageVariants .

Variant versions

versions.json contains a list of Semver versions, one per line.

To update versions in versions.json:

./Update-Versions.ps1

To update versions in versions.json, and open a PR for each changed version, and merge successful PRs one after another (to prevent merge conflicts), and finally create a tagged release and close milestone:

$env:GITHUB_TOKEN = 'xxx'
./Update-Versions.ps1 -PR -AutoMergeQueue -AutoRelease

To perform a dry run, use -WhatIf.

About

Dockerized html-pdf-chrome, with headless chromium running in the background 🐳

License:Apache License 2.0


Languages

Language:PowerShell 54.4%Language:Shell 28.1%Language:JavaScript 10.9%Language:Dockerfile 6.5%