Adds README.md and GitHub Actions to push the built images

This commit is contained in:
Maximilian Kratz 2023-09-08 15:22:07 +02:00
parent f2b4a66e3f
commit 151f31f7f3
3 changed files with 112 additions and 2 deletions

70
.github/workflows/build-and-push.yml vendored Normal file
View file

@ -0,0 +1,70 @@
name: Build Docker images
on:
push:
branches:
- main
- '!testing/**'
- '!feature/**'
- '!hotfix/**'
env:
# Template URL
TEMPLATE_SRC: "https://api.github.com/repos/Wandmalfarbe/pandoc-latex-template/releases/latest"
permissions:
contents: write
jobs:
collect-github-api-artifacts:
runs-on: [ubuntu-22.04]
steps:
- name: Find template source
run: |
RESPONSE=$(curl -s $TEMPLATE_SRC)
echo "curl: $RESPONSE"
LATEST_SRC=$(echo "$RESPONSE" \
| grep "/Eisvogel.zip" \
| cut -d : -f 2,3 \
| tr -d \")
if [[ -z "${LATEST_SRC// }" ]]; then
echo "This runner propably reached it's GitHub API rate limit. Exit."
exit 1
fi
echo "Found URL: $LATEST_SRC"
wget "${LATEST_SRC// }"
- name: Upload template artifact
uses: actions/upload-artifact@v3
with:
name: Eisvogel.zip
path: Eisvogel.zip
build-and-push-image:
needs: [collect-github-api-artifacts]
runs-on: [ubuntu-22.04]
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Download template
uses: actions/download-artifact@v3
with:
name: Eisvogel.zip
- name: Build Docker image
run: |
docker build -t pandoc-builder .
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build image
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: maxkratz/pandoc-builder:latest
platforms: linux/amd64,linux/arm64,linux/arm/v7

View file

@ -52,7 +52,6 @@ jobs:
- name: Build Docker image
run: |
docker build -t pandoc-builder .
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx

View file

@ -1 +1,42 @@
# docker_pandoc-builder
# Docker Pandoc Builder
![Build Status](https://github.com/maxkratz/docker_pandoc-builder/actions/workflows/build-and-push.yml/badge.svg?branch=main)
*Unofficial* [Pandoc](https://github.com/jgm/pandoc) Dockerfile.
Prebuild images can be found at this [Dockerhub repository](https://hub.docker.com/r/maxkratz/pandoc-builder).
*Unofficial* [TeX Live](https://www.tug.org/texlive/) Dockerfile for various versions.
Prebuild images can be found at this [Dockerhub repository](https://hub.docker.com/r/maxkratz/texlive).
## Quickstart
After installing [Docker](https://docs.docker.com/get-docker/), just run the following command inside your LaTeX workspace.
It will mount the current directory to `/data` inside the container.
This path will be used as working directory as defined in the Dockerfile.
```sh
docker run --rm -it -v $PWD:/data maxkratz/pandoc-builder:latest pandoc input.md -o output.pdf --from markdown --template eisvogel
```
If you have a Makefile defined just run the following command from your workspace:
```sh
docker run --rm -it -v ${PWD}:/data maxkratz/pandoc-builder:latest make
```
## Dockerfile
The [Dockerfile](https://github.com/maxkratz/docker_pandoc-builder/blob/main/Dockerfile) can be found at the GitHub repository.
## What gets installed in this image?
The following packages are installed in this Docker image:
* Some utility packages like wget and build essentials etc.
* [TeX Live](https://www.tug.org/texlive/acquire-netinstall.html)
* [Pandoc](https://github.com/jgm/pandoc)
* [Eisvogel template](https://github.com/Wandmalfarbe/pandoc-latex-template)
## Issues & Contribution
If you find any problems, bugs or missing packages, feel free to open an [issue on Github](https://github.com/maxkratz/docker_pandoc-builder/issues).