I am getting this error:
pandoc: sh: openBinaryFile: does not exist (No such file or directory)
when trying to build some assets with Pandoc in a Gitlab CI bash script.
I have a repo, Finnito/Science, that is serving a Gitlab Pages site using Hugo. I am trying to set up a Gitlab CI pipeline to build my HTML slides and PDFs docs from my Markdown source when I commit to the repo so that I don't have to build them locally.
I have been trying out different Docker images of pandoc but decided pandoc/latex is my best bet because it's "official" and built on Alpine which is nice and lightweight. But I can't seem to make heads or tails of this error.
I have tried various different incantations for pandoc but they don't seem to work.
My Gitlab CI job looks like this:
assets:
image: pandoc/latex
script:
- chmod +x ci-build.sh
- sh ci-build.sh
and my ci-build.sh
script looks like this:
#!/bin/sh
modulesToBuild=(
"/builds/Finnito/science/content/10sci/5-fire-and-fuels"
"/builds/Finnito/science/content/10scie/6-geology"
"/builds/Finnito/science/content/11sci/4-mechanics"
"/builds/Finnito/science/content/11sci/5-genetics"
"/builds/Finnito/science/content/12phy/2-mechanics"
"/builds/Finnito/science/content/12phy/3-electricity"
)
for i in "${modulesToBuild[@]}"; do
# Navigate to the directory.
cd $i
# Build the HTML slides and
# PDFs for all markdown docs.
for filename in markdown/*.md; do
file=${filename##*/}
name=${file%%.*}
pandoc/latex pandoc -s --mathjax -i -t revealjs "markdown/$name.md" -o "$name.html"
pandoc/latex pandoc "markdown/$name.md" -o "$name.pdf" --pdf-engine=pdflatex
done
done
Honestly, I'm just pretty lost with how to successfully call pandoc within the Docker container. I am very new to this and it all makes very little sense!
Any help would be most appreciated!
The image has /usr/bin/pandoc
set as an entry point. This means that one doesn't has to specify the pandoc
command when running the container; providing a command it will cause pandoc to try to read an input file with the name of the given command, which causes the error you are seeing.
For a while, images used a custom entrypoint script which tried to detect if a different binary should be executed. But this was reverted as it proved unreliable and confusing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With