diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b817f12..2fe7484 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-latest env: SCHEME: ${{ matrix.scheme }} - TAG: ghcr.io/xu-cheng/texlive-${{ matrix.scheme }} + TAG: ghcr.io/xu-cheng/texlive-${{ matrix.scheme }}-debian steps: - name: Get version run: | @@ -34,10 +34,10 @@ jobs: context: . build-args: scheme=${{ env.SCHEME }} load: true - tags: texlive-${{ env.SCHEME }} + tags: texlive-${{ env.SCHEME }}-debian - name: Test pdflatex run: | - docker run --rm texlive-$SCHEME pdflatex --version + docker run --rm texlive-$SCHEME-debian pdflatex --version cat <ref.bib @book{knuth1997, author = {Donald E. Knuth}, @@ -58,8 +58,8 @@ jobs: \printbibliography \end{document} EOF - docker run --rm -v "$(pwd):/data" -w /data texlive-$SCHEME \ - python3 /opt/texlive/texdir/bin/x86_64-linuxmusl/texliveonfly \ + docker run --rm -v "$(pwd):/data" -w /data texlive-$SCHEME-debian \ + python3 /opt/texlive/bin/texliveonfly \ -c latexmk -a "-g -pdf -halt-on-error -interaction=nonstopmode" test.tex file test.pdf | grep -q ' PDF ' - name: Test latexindent @@ -71,8 +71,7 @@ jobs: test \end{document} EOF - docker run --rm -v $(pwd):/data -w /data texlive-$SCHEME latexindent test.tex - if: "matrix.scheme == 'full'" + docker run --rm -v $(pwd):/data -w /data texlive-$SCHEME-debian latexindent test.tex - name: Login uses: docker/login-action@v3 with: diff --git a/Dockerfile b/Dockerfile index d0479da..33163bc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:latest +FROM debian:bookworm-slim ARG scheme=full LABEL \ @@ -7,7 +7,7 @@ LABEL \ org.opencontainers.image.source="https://github.com/xu-cheng/latex-docker" \ org.opencontainers.image.licenses="MIT" -ENV PATH="/opt/texlive/texdir/bin/x86_64-linuxmusl:${PATH}" +ENV PATH="/opt/texlive/bin:${PATH}" COPY \ LICENSE \ diff --git a/setup.sh b/setup.sh index c5e50d5..4f80627 100755 --- a/setup.sh +++ b/setup.sh @@ -1,6 +1,6 @@ -#!/bin/sh +#!/usr/bin/env bash -set -e +set -eo pipefail scheme="$1" @@ -23,34 +23,52 @@ retry() { done } +case "$(uname -m)" in + x86_64) + echo "binary_x86_64-linux 1" >>/texlive.profile + TEX_ARCH=x86_64-linux + ;; + + aarch64) + echo "binary_aarch64-linux 1" >>/texlive.profile + TEX_ARCH=aarch64-linux + ;; + + *) + echo "Unknown arch: $(uname -m)" >&2 + exit 1 + ;; +esac + echo "==> Install system packages" -apk --no-cache add \ - bash \ +export DEBIAN_FRONTEND=noninteractive +apt-get update -y +apt-get upgrade -y +apt-get install -y \ curl \ fontconfig \ + fonts-freefont-ttf \ ghostscript \ + git \ gnupg \ gnuplot \ - git \ graphviz \ make \ - openjdk21-jre-headless \ + openjdk-17-jre-headless \ perl \ - py-pygments \ python3 \ - tar \ - ttf-freefont \ - wget \ - xz + python3-pygments \ + tar # Dependencies needed by latexindent -apk --no-cache add \ - perl-unicode-linebreak \ - perl-yaml-tiny -apk --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing add \ - perl-file-homedir +apt-get install -y \ + libfile-homedir-perl \ + libunicode-linebreak-perl \ + libyaml-tiny-perl echo "==> Install TeXLive" +mkdir -p /opt/texlive/ +ln -sf "/opt/texlive/texdir/bin/$TEX_ARCH" /opt/texlive/bin mkdir -p /tmp/install-tl cd /tmp/install-tl MIRROR_URL="$(curl -fsS -w "%{redirect_url}" -o /dev/null https://mirror.ctan.org/)" @@ -66,34 +84,22 @@ tar --strip-components 1 -zxf /tmp/install-tl/install-tl-unx.tar.gz -C /tmp/inst retry 3 /tmp/install-tl/installer/install-tl -scheme "scheme-$scheme" -profile=/texlive.profile # Install additional packages for non full scheme -if [ "$scheme" != "full" ]; then +if [[ $scheme != "full" ]]; then tlmgr install \ + collection-bibtexextra \ + collection-binextra \ collection-fontsrecommended \ - collection-fontutils \ - biber \ - biblatex \ - latexmk \ - texliveonfly \ - xindy + collection-fontutils fi -# https://github.com/xu-cheng/latex-action/issues/32#issuecomment-626086551 -ln -sf /opt/texlive/texdir/texmf-dist/scripts/xindy/xindy.pl /opt/texlive/texdir/bin/x86_64-linuxmusl/xindy -ln -sf /opt/texlive/texdir/texmf-dist/scripts/xindy/texindy.pl /opt/texlive/texdir/bin/x86_64-linuxmusl/texindy -curl -OL https://sourceforge.net/projects/xindy/files/xindy-source-components/2.4/xindy-kernel-3.0.tar.gz -tar xf xindy-kernel-3.0.tar.gz -cd xindy-kernel-3.0/src -apk add clisp --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community -make -cp -f xindy.mem /opt/texlive/texdir/bin/x86_64-linuxmusl/ -cd - - # System font configuration for XeTeX and LuaTeX # Ref: https://www.tug.org/texlive/doc/texlive-en/texlive-en.html#x1-330003.4.4 ln -s /opt/texlive/texdir/texmf-var/fonts/conf/texlive-fontconfig.conf /etc/fonts/conf.d/09-texlive.conf fc-cache -fv echo "==> Clean up" +apt-get autoremove -y --purge +apt-get clean -y rm -rf \ /opt/texlive/texdir/install-tl \ /opt/texlive/texdir/install-tl.log \ diff --git a/texlive.profile b/texlive.profile index 91aa826..ab46165 100644 --- a/texlive.profile +++ b/texlive.profile @@ -7,8 +7,6 @@ TEXMFSYSCONFIG /opt/texlive/texdir/texmf-config TEXMFVAR /root/texlive/texmf-var TEXMFCONFIG /root/texlive/texmf-config TEXMFHOME /root/texmf -binary_x86_64-linuxmusl 1 -binary_x86_64-linux 0 instopt_adjustpath 0 instopt_adjustrepo 1 instopt_letter 0