diff --git a/Dockerfile b/Dockerfile index 6e2fa3a..6bc7376 100644 --- a/Dockerfile +++ b/Dockerfile @@ -97,6 +97,7 @@ ENV OUT_DIR="${out_dir}" # Instead of VOLUME, which breaks multi-stage builds: RUN mkdir -p "${src_dir}" "${tmp_dir}" "${out_dir}" +ENV TEXLIVE_REPOSITORY="" COPY entrypoint.sh /bin/entrypoint # Add "aliases" to align `docker run` and `docker exec` usage. RUN set -eo noclobber; \ diff --git a/README.md b/README.md index 8861b19..bae368d 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,33 @@ Place a file called `Texlivefile` with a list of required CTAN packages, one name per line, in the source directory. The container will install all packages on that list before running the work command. +--- +⚠️ Images will stop working once a new version of TeXlive is released with an error like this: + +> tlmgr: Local TeX Live (2023) is older than remote repository (2024). + +If you need to keep using an older image for a little while, +you can override the repository by setting environment variable +`TEXLIVE_REPOSITORY` to a value like +``` +https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2023/tlnet-final +``` +This feature has been available since 2024.1; +see + [reitzig/texlive-docker#18.2022953222](https://github.com/reitzig/texlive-docker/issues/18#issuecomment-2022953222) +for hints on how to backport it to older images. + +⚠️ Note that most CTAN mirrors do not maintain historic versions +(cf. [tex.SE#460132](https://tex.stackexchange.com/questions/460132/historic-tex-live-distributions-https-sftp-mirror)), +so keep in mind that widespread use of this workaround _will_ stress those few mirrors that do. +We strongly recommend upgrading to the latest TeXlive version as soon as possible! + + + + +--- + ### Parameters You can adjust some defaults of the diff --git a/entrypoint.sh b/entrypoint.sh index 6176cba..a7b4165 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -34,20 +34,23 @@ Commands: Environment Variables: - OUT_DIR Directory for the relevant output of work commands. - Default: /work/out - SRC_DIR Directory with project sources. Can be read-only. - Default: /work/src - TMP_DIR The working directory for work commands. - Default: /work/tmp - BUILDSCRIPT Script in SRC_DIR that can be run by the work command. - Default: build.sh - TEXLIVEFILE A file in SRC_DIR that contains the TeXlive packages the - project requires, one package name per line. - Default: Texlivefile - OUTPUT Bash glob pattern that defines the relevant output of - work commands. - Default: '*.pdf *.log' + OUT_DIR Directory for the relevant output of work commands. + Default: /work/out + SRC_DIR Directory with project sources. Can be read-only. + Default: /work/src + TMP_DIR The working directory for work commands. + Default: /work/tmp + BUILDSCRIPT Script in SRC_DIR that can be run by the work command. + Default: build.sh + TEXLIVE_REPOSITORY Direct URL to a TeXlive repository; + bypasses use of mirrors.ctan.org and gives access to history versions. + Default: empty (default behaviour of tlmgr) + TEXLIVEFILE A file in SRC_DIR that contains the TeXlive packages the + project requires, one package name per line. + Default: Texlivefile + OUTPUT Bash glob pattern that defines the relevant output of + work commands. + Default: '*.pdf *.log' HELP )" @@ -94,9 +97,15 @@ case "${command}" in if [[ -f "${SRC_DIR}/${TEXLIVEFILE}" ]]; then if ! sha256sum -c "${hashfile}" > /dev/null 2>&1; then + tlrepo="" + if [ -n "${TEXLIVE_REPOSITORY}" ]; then + echo "Will use TeXlive repository ${TEXLIVE_REPOSITORY}" + tlrepo="--repository ${TEXLIVE_REPOSITORY}" + fi + echo "Installing dependencies ..." - tlmgr update --self - xargs tlmgr install < "${SRC_DIR}/${TEXLIVEFILE}" + tlmgr update ${tlrepo} --self + xargs tlmgr install ${tlrepo} < "${SRC_DIR}/${TEXLIVEFILE}" tlmgr path add sha256sum "${SRC_DIR}/${TEXLIVEFILE}" > "${hashfile}" else