Dockerfile to generate a Docker image for helping in single source publishing, with all sources of documentation written in pandoc markdown and a publication workflow based on Jekyll, with pandoc as the Markdown rendering engine and theme based on Tufte. Output expected in HTML (Jekyll) and PDF.
How to run your Jekyll site in the container provided by fbab/jekpandocker ?
3 alternative usages described below:
-
- Use on desktop the remote predefined image
-
- Load in CI/CD the remote predefined image
-
- Build on your own
Choose the one that fits your needs !
- Suppose your desktop is Windows 10 (Powershell), Git installed, Docker installed and running (as administrator).
- Have a Jekyll site in C:\tmp\minimal
You can visit the image page on DockerHub.
docker pull fbab/jekpandocker
docker run --rm --name jekpandocker-container -v "C:\tmp\minimal:/srv/jekyll/" fbab/jekpandocker jekyll serve
You can then browse your Jekyll site on port 4000
browser> http://localhost:4000
The same image can be reffered in CI/CD scripts. Visit your Jekyll website at the address delivered by your CI/CD (Github Pages, Gitlab Pages, ...).
cf https://docs.github.com/en/actions/creating-actions/creating-a-docker-container-action
Example of .gitlab-ci.yml
image: fbab/jekpandocker
script:
- gem install bundler
- bundle install
- bundle exec jekyll build -d public --trace --config _config.yml,_config_gitlab.yml
- pwd
- find . -name "*"
artifacts:
paths:
# The folder that contains the files to be exposed at the Page URL ...
- public
rules:
# This ensures that only pushes to the default branch will trigger
# a pages deploy // $CI_COMMIT_REF_NAME
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
0A> open a Windows Powershell command (as administrator)
0B> cd /tmp
1A> git clone https://github.com/prodageo/jekpandocker
2A> (Get-Content 'copy/all/usr/jekyll/bin/bundle' -Raw) -match "\n$"
3A> cd /tmp/jekpandocker
4A> docker build -t jekpandocker-image .
5A> docker run --rm --name jekpandocker-container -v "C:\tmp\minimal:/srv/jekyll/" jekpandocker-image
This command checks the line endings of files that will be read in the container. If returns false, probably the line endings of files have been set to crlf (\r\n) by git clone, check the git attribute value of core.autocrlf. Credits from Stackoverflow pseudo: Charles Ross, Antony Hatchkins
All this stuff would not have been possible without great work done in: