This script will create an OCI image using buildah, which can be run using Podman.
To build the image juste run the Podmanfile script
$ ./Podmanfile
$ podman images
REPOSITORY TAG IMAGE ID CREATED SIZE
localhost/asciidoctor-pdf 20190119 a04fa7409faa 4 minutes ago 399 MB
$ podman run --rm \
--name=asciidoctor
-v $(CURDIR):/data:rw,Z \
quay.io/tinsjourney/asciidoctor-pdf main.adoc -o engagement-journal.pdf
Where:
$(CURDIR)
: This location contains files from your host that need to be accessible by asciidoc-pdf. Should be the directory where your asciidoc file are.main.adoc
: This is the main asciidoc fileengagement-journal.pdf
: The name of the output pdf.
To find the right command you just need to display the runlabel.
$ podman container runlabel -p --display run quay.io/tinsjourney/asciidoctor-pdf
Command: /proc/self/exe run --rm --name asciidoctor -v $(CURDIR):/data:rw,Z quay.io/tinsjourney/asciidoctor-pdf:latest main.adoc -o engagement-journal.pdf
Asciidoctor PDF also provides a shell script that invokes GhostScript (gs) to optimize and compress the generated PDF with minimal impact on quality. See Optional Scripts on asciidoctor-pdf github page for more information.
In order to use it with the container image, we need to overwrite the entrypoint
$ podman run --rm \
--name=asciidoctor \
-v $(CURDIR):/data:rw,Z \
--entrypoint /usr/local/bin/optimize-pdf /
quay.io/tinsjourney/asciidoctor-pdf engagement-journal.pdf