Added standalone build capability
parent
f32cfa057b
commit
d6c4dab27f
|
@ -4,19 +4,37 @@ LABEL maintiner="Mark <mark@betalupi.com>"
|
|||
RUN pacman -Fyy --noconfirm && \
|
||||
#pacman -Syu --noconfirm && \
|
||||
pacman -Sy --noconfirm \
|
||||
# Texlive
|
||||
#tectonic \
|
||||
texlive-most \
|
||||
texlive-fontsextra \
|
||||
texlive-lang \
|
||||
# Tectonic
|
||||
tectonic
|
||||
texlive-lang
|
||||
|
||||
RUN pacman -Sy --noconfirm \
|
||||
# texlive optional deps
|
||||
python-pygments \
|
||||
inkscape \
|
||||
java-environment \
|
||||
perl-tk \
|
||||
ghostscript \
|
||||
java-runtime \
|
||||
psutils \
|
||||
wdiff \
|
||||
# Other tools
|
||||
curl \
|
||||
git \
|
||||
openssh \
|
||||
python
|
||||
|
||||
ENV HOME /data
|
||||
WORKDIR /data
|
||||
VOLUME /data
|
||||
ENV HOME /work
|
||||
WORKDIR /work
|
||||
VOLUME /work
|
||||
VOLUME /build
|
||||
|
||||
# CD_DIR is relative to data.
|
||||
ENV LATEXMK_CD_DIR .
|
||||
ENV SKIP_ENTRY false
|
||||
|
||||
COPY run.sh /run.sh
|
||||
|
||||
# Don't include this, we want the entrypoint to be called manually.
|
||||
#ENTRYPOINT [ "/bin/bash", "/entrypoint.sh" ]
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
# LaTeX Image
|
||||
|
||||
A docker image that contains `latexmk` and all requirements. Can be used by CI/CD, or can act as a simple replacement of a full latex installation.
|
||||
|
||||
|
||||
## Contents
|
||||
- `Dockerfile`: Builds the image
|
||||
- `run.sh`: Copied into the container, runs `latexmk`
|
||||
- `latexmk.sh`: Run by host system, can replace `latexmk`.
|
||||
|
||||
|
||||
## Notes
|
||||
|
||||
This image has no entrypoint to make it compatible with CI/CD tools. `run.sh` is executed manually (see `latexmk.sh`).
|
||||
|
||||
The image takes a few envvars, they are all documented in `latexmk.sh`.
|
|
@ -0,0 +1,44 @@
|
|||
#!/bin/bash
|
||||
|
||||
# This script is a complete replacement for latexmk,
|
||||
# using this docker container.
|
||||
|
||||
|
||||
# All arguments are passed to latexmk,
|
||||
# so options are provided via envvars.
|
||||
|
||||
# These options should never be changed,
|
||||
# use LATEX_OUT_DIR.
|
||||
if [[ $@ == *"-outdir"* ]] || [[ $@ == *"-output-directory"* ]] ; then
|
||||
echo "Do not set output dir while using this script." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# What directory we should bind to /work.
|
||||
if [[ -z "$LATEXMK_WORK_DIR" ]] ; then
|
||||
LATEXMK_WORK_DIR="/"
|
||||
fi
|
||||
|
||||
# CD to this path inside LATEXMK_WORK_DIR.
|
||||
# Must be relative.
|
||||
if [[ -z "$LATEXMK_CD_DIR" ]] ; then
|
||||
LATEXMK_CD_DIR="$(realpath --relative-to="$LATEXMK_WORK_DIR" "$(pwd)")"
|
||||
fi
|
||||
|
||||
# Default path for output
|
||||
if [[ -z "$LATEX_OUT_DIR" ]] ; then
|
||||
LATEX_OUT_DIR="./build"
|
||||
fi
|
||||
|
||||
# Docker wants relative paths
|
||||
# mkdir here so we don't have permission problems
|
||||
LATEX_OUT_DIR=$(realpath "$LATEX_OUT_DIR")
|
||||
mkdir -p "$LATEX_OUT_DIR"
|
||||
|
||||
docker run --rm \
|
||||
--user $(id -u):$(id -g) \
|
||||
-v "$LATEXMK_WORK_DIR:/work:ro" \
|
||||
-v "$LATEX_OUT_DIR:/build" \
|
||||
-e "LATEXMK_CD_DIR=$LATEXMK_CD_DIR" \
|
||||
git.betalupi.com/mark/latex \
|
||||
bash /run.sh $@
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
cd "/work/$LATEXMK_CD_DIR"
|
||||
|
||||
if [ "$SKIP_ENTRY" = false ] ; then
|
||||
latexmk -outdir=/build "$@"
|
||||
else
|
||||
bash
|
||||
fi
|
Loading…
Reference in New Issue