0

I want to make a docker image with a minimal installation of pdlatex and xelatex. I want the ability to manually install the packages I need (e.g. fontawesome)

Because I'm trying to be minimal, I want to use Alpine, not Ubuntu. However for most installation methods, it seems tlmgr does not get installed, or does not work.

What I've tried

  1. natlownes image: Ubuntu based, so too large (2GB)
  2. blang image: build fails. Ubuntu based, so too would be large anyway.
  3. My own dockerfile, using apk add (distro repo)
FROM alpine

RUN apk add --no-cache \
        texlive \
        texlive-xetex \
        texmf-dist \
        texmf-dist-formatsextra \
        texmf-dist-latexextra \
        texmf-dist-pictures \
        texmf-dist-science
RUN tlmgr install fontawesome

Fails with

Can't locate TeXLive/TLPDB.pm in @INC (you may need to install the TeXLive::TLPDB module) (@INC contains: /usr/share/texmf-dist/scripts/texlive /usr/share/tlpkg /usr/local/lib/perl5/site_perl /usr/local/share/perl5/site_perl /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5/core_perl /usr/share/perl5/core_perl) at /usr/bin/tlmgr line 99.
BEGIN failed--compilation aborted at /usr/bin/tlmgr line 99.
  1. my own dockerfile, using netinstall
sudo docker run -it --rm alpine sh
apk add --no-cache perl
wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
tar -xzf install-tl-unx.tar.gz
cd install-tl-unx
./install-tl

output:

query_ctan_mirror: Programs not set up, trying wget
cannot contact mirror.ctan.org, returning a backbone server!
Loading http://www.ctan.org/tex-archive/systems/texlive/tlnet/tlpkg/texlive.tlpdb

./install-tl: TLPDB::from_file could not download http://www.ctan.org/tex-archive/systems/texlive/tlnet/tlpkg/texlive.tlpdb;
./install-tl: maybe the repository setting should be changed.

Interestingly I can just wget http://www.ctan.org/tex-archive/systems/texlive/tlnet/tlpkg/texlive.tlpdb, and that works. But I don't know where in all the large installation scripts I need to look to skip that bit.

summary

How can I get either option 3 or 4 to work?

Desired result: pdflatex, xelatex and fontawesome are installed on Alpine Linux.

  • Just a comment concerning the "packages you want": In my own attempts to create a minimal LaTeX image (tex.stackexchange.com/a/466051/124577) I had to switch to Debian again, because some binaries (e.g. biber) are not shipped for Linux/MUSL (i.e. Alpine) which renders some workflows (e.g. biblatex+biber) unusable. – TeXnician Jun 1 at 14:19
  • Yeah, I couldn't get TinyTex working on Alpine. I did get it working on Ubuntu. I've written an answer to my own question using that approach. – falsePockets Jun 2 at 23:44
1

It turns out that the difference in size between Ubuntu and Alpine is small compared to the size of a minimal LaTeX installation.

So I've just installed TinyTex on Ubuntu.

FROM ubuntu:bionic

WORKDIR /var/local

# combine into one run command to reduce image size
RUN apt-get update && apt-get install -y perl wget libfontconfig1 && \
    wget -qO- "https://yihui.name/gh/tinytex/tools/install-unx.sh" | sh  && \
    apt-get clean
ENV PATH="${PATH}:/root/bin"
RUN tlmgr install xetex
RUN fmtutil-sys --all

# install only the packages you need
# this is the bit which fails for most other methods of installation
RUN tlmgr install xcolor pgf fancyhdr parskip babel-english units lastpage mdwtools comment genmisc fontawesome

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.