commit 15c34ae2c084a4f30e90f6e48ac40462c650be2b Author: Janis Hutz Date: Mon Dec 22 17:54:23 2025 +0100 Set up diff --git a/.gitea/workflows/create-and-publish.yml b/.gitea/workflows/create-and-publish.yml new file mode 100644 index 0000000..609cb2c --- /dev/null +++ b/.gitea/workflows/create-and-publish.yml @@ -0,0 +1,15 @@ +name: Create and publish container +on: + push +jobs: + build_container: + runs_on: ubuntu-latest + steps: + - name: Check out Git repository + uses: actions/checkout@v6 + with: + ref: main + - name: Build and upload image + run: | + docker login -u ${{ variables.REGISTRY_USER_USERNAME }} -p ${{ secrets.REGISTRY_USER_PASSWORD }} + ./build-image.sh ${{ variables.REGISTRY_URL }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..19f3ec3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM alpine + +WORKDIR /root + +RUN apk add texlive texlive-bibtexextra texlive-context texlive-dvi texlive-fontutils texmf-dist-langgerman texlive-latexextra texlive-latexrecommended texlive-mathscience texlive-pictures texlive-plaingeneric texlive-pstricks + +COPY entrypoint.sh /root/ +RUN chmod +x /root/entrypoint.sh + +ENTRYPOINT [ "/root/entrypoint.sh" ] diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..3c42fea --- /dev/null +++ b/LICENSE @@ -0,0 +1,18 @@ +MIT License + +Copyright (c) 2025 janishutz + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the +following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT +LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO +EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..fef3f6b --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +# latex-build + +Docker resources to build a docker image to compile latex files in gitea CI + +## Usage +Build the docker image using +```bash +./build-image.sh your-image-name +``` +You can then run the image using +```bash +docker run --name container-name -v /path/to/latex/build/dir/on/host:/root/data your-image-name:latest +``` +The arguments that can be passed to the container are the following (in order): +1. Extra arguments for `latexmk` (you can also use this to provide the entry file) +2. Extra packages (alpine linux) to install in the container diff --git a/build-image.sh b/build-image.sh new file mode 100755 index 0000000..a873d09 --- /dev/null +++ b/build-image.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +docker buildx build . -t "$1" +docker push "$1" diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..5f101a6 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +set -e + +EXTRA_ARGS="$1" +EXTRA_PKGS="$2" + +if [ -n "$EXTRA_PKGS" ]; then + for pkg in $EXTRA_PKGS; do + echo "Install $pkg by apk" + apk add "$pkg" + done +fi + +cd /root/data + +if [ -n "$WORKING_DIR" ]; then + cd "$WORKING_DIR" +fi + +echo "Runner started, will run latexmk with extra args $EXTRA_ARGS" + +latexmk -pdf $EXTRA_ARGS