|
| 1 | +# _ _____ __ __ |
| 2 | +# | | __ |_ _|__\ \/ / |
| 3 | +# | | / _` || |/ _ \\ / |
| 4 | +# | |__| (_| || | __// \ |
| 5 | +# |_____\__,_||_|\___/_/\_\ |
| 6 | +# |
| 7 | +FROM pandoc/core:3.8.3-alpine |
| 8 | + |
| 9 | +# NOTE: to maintainers, please keep this listing alphabetical. |
| 10 | +RUN apk --no-cache add \ |
| 11 | + curl \ |
| 12 | + fontconfig \ |
| 13 | + freetype \ |
| 14 | + gnupg \ |
| 15 | + gzip \ |
| 16 | + perl \ |
| 17 | + tar \ |
| 18 | + wget \ |
| 19 | + xz |
| 20 | + |
| 21 | +# Installer config |
| 22 | +COPY <<EOF /root/texlive.profile |
| 23 | +# NOTE: Setting the binary type is done shortly before the installation, |
| 24 | +# because we need to know the architecture on which this is running. |
| 25 | +# E.g., for amd64 on Alpine, `binary_x86_64-linuxmusl 1` is appended to |
| 26 | +# this file. |
| 27 | +selected_scheme scheme-basic |
| 28 | +TEXDIR /opt/texlive/texdir |
| 29 | +TEXMFLOCAL /opt/texlive/texmf-local |
| 30 | +TEXMFSYSVAR /opt/texlive/texdir/texmf-var |
| 31 | +TEXMFSYSCONFIG /opt/texlive/texdir/texmf-config |
| 32 | +TEXMFVAR ~/.texlive/texmf-var |
| 33 | +TEXMFCONFIG ~/.texlive/texmf-config |
| 34 | +TEXMFHOME ~/texmf |
| 35 | +instopt_adjustpath 0 |
| 36 | +instopt_adjustrepo 1 |
| 37 | +instopt_letter 0 |
| 38 | +instopt_portable 0 |
| 39 | +instopt_write18_restricted 1 |
| 40 | +tlpdbopt_autobackup 0 |
| 41 | +tlpdbopt_backupdir tlpkg/backups |
| 42 | +tlpdbopt_create_formats 1 |
| 43 | +tlpdbopt_desktop_integration 1 |
| 44 | +tlpdbopt_file_assocs 1 |
| 45 | +tlpdbopt_generate_updmap 0 |
| 46 | +tlpdbopt_install_docfiles 0 |
| 47 | +tlpdbopt_install_srcfiles 0 |
| 48 | +tlpdbopt_post_code 1 |
| 49 | +tlpdbopt_sys_bin /usr/local/bin |
| 50 | +tlpdbopt_sys_info /usr/local/share/info |
| 51 | +tlpdbopt_sys_man /usr/local/share/man |
| 52 | +tlpdbopt_w32_multi_user 1 |
| 53 | +EOF |
| 54 | + |
| 55 | +# TeXLive binaries location |
| 56 | +ARG texlive_bin="/opt/texlive/texdir/bin" |
| 57 | + |
| 58 | +# TeXLive mirror URL (leave empty to use the default mirror). |
| 59 | +ARG texlive_mirror_url= |
| 60 | + |
| 61 | +# Modify PATH environment variable, prepending TexLive bin directory |
| 62 | +ENV PATH="${texlive_bin}/default:${PATH}" |
| 63 | + |
| 64 | +# Ideally, the image would always install "linuxmusl" binaries. However, |
| 65 | +# those are not available for aarch64, so we install binaries that have |
| 66 | +# been built against libc and hope that the compatibility layer works |
| 67 | +# well enough. |
| 68 | +RUN <<EOF |
| 69 | +set -eux |
| 70 | +cd /root |
| 71 | +ARCH="$(uname -m)" |
| 72 | +case "$ARCH" in |
| 73 | + ('x86_64') TEXLIVE_ARCH="x86_64-linuxmusl" |
| 74 | + ;; |
| 75 | + (*) echo >&2 "error: unsupported architecture '$ARCH'"; |
| 76 | + exit 1 |
| 77 | + ;; |
| 78 | +esac |
| 79 | +mkdir -p ${texlive_bin} |
| 80 | +ln -sf "${texlive_bin}/${TEXLIVE_ARCH}" "${texlive_bin}/default" |
| 81 | +# Request musl precompiled binary access |
| 82 | +echo "binary_${TEXLIVE_ARCH} 1" >> /root/texlive.profile |
| 83 | + |
| 84 | +# Install TeXLive |
| 85 | +mirror_url="${texlive_mirror_url}" |
| 86 | + |
| 87 | +if [ -z "${mirror_url}" ]; then |
| 88 | + # Get the mirror URL from the redirect. Otherwise, if we were to |
| 89 | + # always use the mirror URL, we'd run into problems whenever we get |
| 90 | + # installer and signatures from different mirrors that are not 100% |
| 91 | + # in sync. |
| 92 | + mirror_url=$(wget -4 --quiet --output-document=/dev/null \ |
| 93 | + --server-response \ |
| 94 | + http://mirror.ctan.org/ \ |
| 95 | + 2>&1 | \ |
| 96 | + sed -ne 's/.*Location: \(.*\)$/\1/p' | head -n 1) |
| 97 | +fi |
| 98 | + |
| 99 | +# Trim trailing slash(es) |
| 100 | +mirror_url=$(echo "$mirror_url" | sed -e 's/\/*$//') |
| 101 | + |
| 102 | +installer_url="${mirror_url}/systems/texlive/tlnet" |
| 103 | + |
| 104 | +# Download the install-tl perl script. The archive integrity and signature is |
| 105 | +# verified later, so it's ok if we use an insecure connection. |
| 106 | +wget -4 --no-verbose --no-check-certificate \ |
| 107 | + "$installer_url/install-tl-unx.tar.gz" \ |
| 108 | + "$installer_url/install-tl-unx.tar.gz".sha512 \ |
| 109 | + "$installer_url/install-tl-unx.tar.gz".sha512.asc \ |
| 110 | + |
| 111 | +## Verifiy installer integrity |
| 112 | +# get current signing key |
| 113 | +gpg --keyserver keyserver.ubuntu.com \ |
| 114 | + --receive-key 0xC78B82D8C79512F79CC0D7C80D5E5D9106BAB6BC || exit 5 |
| 115 | +gpg --verify install-tl-unx.tar.gz.sha512.asc || exit 5 |
| 116 | +sha512sum install-tl-unx.tar.gz.sha512 || exit 5 |
| 117 | + |
| 118 | +## Proceed with installation |
| 119 | +# Extract installer |
| 120 | +mkdir -p ./install-tl |
| 121 | +tar --strip-components 1 -zvxf install-tl-unx.tar.gz -C "$PWD/install-tl" |
| 122 | + |
| 123 | +# Run the default installation with the specified profile. |
| 124 | +./install-tl/install-tl \ |
| 125 | + -repository "${installer_url}" \ |
| 126 | + --profile=/root/texlive.profile |
| 127 | + |
| 128 | +# Cleanup installation artifacts. |
| 129 | +rm -rf \ |
| 130 | + ./install-tl \ |
| 131 | + install-tl-unx.tar.gz \ |
| 132 | + install-tl-unx.tar.gz.sha512 \ |
| 133 | + install-tl-unx.tar.gz.sha512.asc |
| 134 | + |
| 135 | +# Install packages required by pandoc |
| 136 | +tlmgr install \ |
| 137 | + --verify-repo=all \ |
| 138 | + amsfonts \ |
| 139 | + amsmath \ |
| 140 | + babel \ |
| 141 | + babel-basque \ |
| 142 | + babel-czech \ |
| 143 | + babel-danish \ |
| 144 | + babel-dutch \ |
| 145 | + babel-english \ |
| 146 | + babel-finnish \ |
| 147 | + babel-french \ |
| 148 | + babel-german \ |
| 149 | + babel-hungarian \ |
| 150 | + babel-italian \ |
| 151 | + babel-norsk \ |
| 152 | + babel-polish \ |
| 153 | + babel-portuges \ |
| 154 | + babel-spanish \ |
| 155 | + babel-swedish \ |
| 156 | + beamer \ |
| 157 | + biber \ |
| 158 | + biblatex \ |
| 159 | + bibtex \ |
| 160 | + bidi \ |
| 161 | + bidi \ |
| 162 | + bookmark \ |
| 163 | + booktabs \ |
| 164 | + caption \ |
| 165 | + cleveref \ |
| 166 | + csquotes \ |
| 167 | + euler \ |
| 168 | + eurosym \ |
| 169 | + fancyvrb \ |
| 170 | + float \ |
| 171 | + fontspec \ |
| 172 | + footnotehyper \ |
| 173 | + framed \ |
| 174 | + geometry \ |
| 175 | + graphics \ |
| 176 | + hyperref \ |
| 177 | + hyphen-basque \ |
| 178 | + hyphen-czech \ |
| 179 | + hyphen-danish \ |
| 180 | + hyphen-dutch \ |
| 181 | + hyphen-english \ |
| 182 | + hyphen-finnish \ |
| 183 | + hyphen-french \ |
| 184 | + hyphen-german \ |
| 185 | + hyphen-hungarian \ |
| 186 | + hyphen-italian \ |
| 187 | + hyphen-norwegian \ |
| 188 | + hyphen-polish \ |
| 189 | + hyphen-portuguese \ |
| 190 | + hyphen-spanish \ |
| 191 | + hyphen-swedish \ |
| 192 | + ifmtarg \ |
| 193 | + iftex \ |
| 194 | + latexmk \ |
| 195 | + listings \ |
| 196 | + lm \ |
| 197 | + lm-math \ |
| 198 | + lua-ul \ |
| 199 | + luacode \ |
| 200 | + luacolor \ |
| 201 | + lualatex-math \ |
| 202 | + luatexbase \ |
| 203 | + mathspec \ |
| 204 | + memoir \ |
| 205 | + microtype \ |
| 206 | + multirow \ |
| 207 | + natbib \ |
| 208 | + parskip \ |
| 209 | + pgf \ |
| 210 | + selnolig \ |
| 211 | + setspace \ |
| 212 | + soul \ |
| 213 | + subfig \ |
| 214 | + tools \ |
| 215 | + unicode-math \ |
| 216 | + upquote \ |
| 217 | + xcolor \ |
| 218 | + xetex \ |
| 219 | + xurl |
| 220 | +# Reset to the default CTAN mirror, unless a specific mirror had been |
| 221 | +# requested. |
| 222 | +if [ -z "${texlive_mirror_url}" ]; then |
| 223 | + tlmgr option repository ctan |
| 224 | +fi |
| 225 | + |
| 226 | +rm -f /root/texlive.profile |
| 227 | + |
| 228 | +# Update fonts |
| 229 | +TERM=dumb luaotfload-tool --update && \ |
| 230 | +chmod -R o+w /opt/texlive/texdir/texmf-var |
| 231 | +EOF |
0 commit comments