-
Notifications
You must be signed in to change notification settings - Fork 2
/
Podmanfile
executable file
·38 lines (30 loc) · 2.21 KB
/
Podmanfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env bash
# Create a build container
container=$(buildah from --name asciidoctor-pdf fedora)
# Installation dependencies (https://github.com/asciidoctor/asciidoctor-pdf#prerequisites)
# Package python is needed for pygments.rb
buildah run $container /usr/bin/dnf -y --setopt=tsflags=nodocs --setopt=install_weak_deps=false update
buildah run $container /usr/bin/dnf -y --setopt=tsflags=nodocs --setopt=install_weak_deps=false install rubygems liberation-sans-fonts python ghostscript redhat-text-fonts redhat-display-fonts
buildah run $container /usr/bin/dnf -y --setopt=tsflags=nodocs --setopt=install_weak_deps=false install redhat-rpm-config gcc ruby-devel
# Install asciidoctor-pdf
buildah run $container /usr/bin/gem install --no-document --minimal-deps --clear-sources --pre asciidoctor-pdf concurrent-ruby coderay pygments.rb rouge json asciidoctor-diagram
buildah run $container /usr/bin/curl -o /usr/local/bin/optimize-pdf https://raw.githubusercontent.com/asciidoctor/asciidoctor-pdf/master/bin/optimize-pdf
buildah run $container /usr/bin/chmod +x /usr/local/bin/optimize-pdf
buildah config --workingdir /data $container
buildah config --entrypoint '["/usr/local/bin/asciidoctor-pdf"]' $container
buildah config --created-by "Tinsjourney" $container
buildah config --author "tintin@gnali.org @tinsjourney" --label name=asciidoctor-pdf $container
buildah config --label run="podman run --rm --name asciidoctor -v \$(CURDIR):/data:rw,Z IMAGE main.adoc -o engagement-journal.pdf" $container
# Some cleaning
buildah run $container /usr/bin/dnf -y history undo 4
buildah run $container /usr/bin/dnf clean all
buildah run $container /usr/bin/rm -rf /var/cache/dnf
# Finally saves the running container to an image
echo "==== Commit image ===="
buildah commit --rm $container asciidoctor-pdf:$(date +%Y%m%d)
# Push images to external repository
echo "==== Push image to quay.io ===="
buildah push asciidoctor-pdf:$(date +%Y%m%d) docker://quay.io/tinsjourney/asciidoctor-pdf:$(date +%Y%m%d)
echo "==== Push image to docker.io ===="
buildah push asciidoctor-pdf:$(date +%Y%m%d) docker://docker.io/tinsjourney/asciidoctor-pdf:$(date +%Y%m%d)
buildah push asciidoctor-pdf:$(date +%Y%m%d) docker://docker.io/tinsjourney/asciidoctor-pdf:latest