Skip to contentSkip to conversation

docker: Downgrade latexpand to v1.3

PATCH Applied Akira Yokosawa 2 participants 2 messages May 2, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 docker: Downgrade latexpand to v1.3

The latest version of latexpand (v1.6) is much slower than the one found on Ubuntu Bionic.
It is caused by the internal use of "kpsewitch" and other improvements. As perfbook's LaTeX code base uses a lot of \input{}s, the runtime of laetxpand becomes excessively long.

Comparison of "rm autodate.tex; time make perfbook_flat.tex":

latexpand v1.3: real 0m1.031s

latexpand v1.6: real 0m16.266s

For perfbook, latexpand v1.3 is good enough.
To reduce build time, install latexpand v1.3 in docker images.

Also add Dockerfile.bionic, which is based on ubuntu:bionic and add a couple of up-to-date LaTeX packages and a2ping under /usr/local/share and /usr/local/bin.

Note: On the host, you can download it from

    https://gitlab.com/latexpand/latexpand/-/archive/v1.3/latexpand-v1.3.tar.gz

, and put it into your own bin directory.

---
 docker/Dockerfile        |  5 +++++
 docker/Dockerfile.bionic | 40 ++++++++++++++++++++++++++++++++++++++++
 docker/Dockerfile.fedora |  4 ++++
 3 files changed, 49 insertions(+)
 create mode 100644 docker/Dockerfile.bionic
docker/Dockerfile +5 -0
index a5afe6ea..7527e08b 100644
@@ -12,6 +12,11 @@ RUN apt-get update && apt-get install -y fig2ps inkscape xfig graphviz psutils \
     rm -rf /var/lib/apt/lists/*
 COPY steel-city-comic.regular.ttf /usr/local/share/fonts/
 RUN fc-cache /usr/local/share/fonts/
+RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
+WORKDIR /opt
+RUN curl https://gitlab.com/latexpand/latexpand/-/archive/v1.3/latexpand-v1.3.tar.gz -o - | tar xfz - && \
+    sed -i -e 's/@LATEXPAND_VERSION@/v1.3/' latexpand-v1.3/latexpand && \
+    cp latexpand-v1.3/latexpand /usr/local/bin
 ARG uid=1000
 ARG gid=1000
 ARG user=perfbook
docker/Dockerfile.bionic new file +40 -0
new file mode 100644
index 00000000..56e6280e
@@ -0,0 +1,40 @@
+FROM ubuntu:bionic
+
+RUN apt-get update && apt-get install -y locales && \
+    localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 && \
+    rm -rf /var/lib/apt/lists/*
+ENV LANG en_US.utf8
+RUN apt-get update && DEBIAN_FRONTEND=noninteractive TZ=UTC apt-get install -y tzdata && \
+    rm -rf /var/lib/apt/lists/*
+RUN apt-get update && apt-get install -y fig2ps inkscape xfig graphviz psutils \
+    texlive-publishers texlive-pstricks texlive-science texlive-fonts-extra \
+    make nano vim git && \
+    rm -rf /var/lib/apt/lists/*
+COPY steel-city-comic.regular.ttf /usr/local/share/fonts/
+RUN fc-cache /usr/local/share/fonts/
+RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
+WORKDIR /opt
+RUN curl https://mirrors.ctan.org/macros/latex/contrib/cleveref.zip -L -O && unzip cleveref.zip && \
+    curl https://mirrors.ctan.org/macros/latex/contrib/epigraph.zip -L -O && unzip epigraph.zip && \
+    curl https://mirrors.ctan.org/macros/latex/contrib/glossaries-extra.zip -L -O && unzip glossaries-extra.zip && \
+    cd cleveref; latex cleveref.ins; cd .. && \
+    mkdir -p /usr/local/share/texmf/tex/latex/cleveref && \
+    cp cleveref/cleveref.sty /usr/local/share/texmf/tex/latex/cleveref && \
+    cd epigraph; latex epigraph.ins; cd .. && \
+    mkdir -p /usr/local/share/texmf/tex/latex/epigraph && \
+    cp epigraph/epigraph.sty /usr/local/share/texmf/tex/latex/epigraph && \
+    cd glossaries-extra; latex glossaries-extra.ins; cd .. && \
+    mkdir -p /usr/local/share/texmf/tex/latex/glossaries-extra && \
+    cp glossaries-extra/*.sty /usr/local/share/texmf/tex/latex/glossaries-extra && \
+    texhash /usr/local/share/texmf && \
+    curl https://mirrors.ctan.org/graphics/a2ping.zip -L -O && unzip a2ping.zip && \
+    cp a2ping/a2ping.pl /usr/local/bin/a2ping
+ARG uid=1000
+ARG gid=1000
+ARG user=perfbook
+ARG group=perfbook
+RUN groupadd -g $gid $group && useradd -u $uid -g $gid -m $user
+VOLUME /work
+USER $uid:$gid
+WORKDIR /work
+CMD /bin/bash
docker/Dockerfile.fedora +4 -0
index 4a3ab855..33add84d 100644
@@ -10,6 +10,10 @@ RUN dnf -y update && dnf install -y --setopt=tsflags=nodocs \
     mktexlsr
 COPY steel-city-comic.regular.ttf /usr/local/share/fonts/
 RUN fc-cache /usr/local/share/fonts/
+WORKDIR /opt
+RUN curl https://gitlab.com/latexpand/latexpand/-/archive/v1.3/latexpand-v1.3.tar.gz -o - | tar xfz - && \
+    sed -i -e 's/@LATEXPAND_VERSION@/v1.3/' latexpand-v1.3/latexpand && \
+    cp latexpand-v1.3/latexpand /usr/local/bin
 ARG uid=1000
 ARG gid=1000
 ARG user=perfbook
Signature · 1 line
2.17.1
#1 lore raw
Quoted 19 lines · Akira Yokosawa

The latest version of latexpand (v1.6) is much slower than the one found on Ubuntu Bionic.
It is caused by the internal use of "kpsewitch" and other improvements. As perfbook's LaTeX code base uses a lot of \input{}s, the runtime of laetxpand becomes excessively long.

Comparison of "rm autodate.tex; time make perfbook_flat.tex":

latexpand v1.3: real 0m1.031s

latexpand v1.6: real 0m16.266s

For perfbook, latexpand v1.3 is good enough.
To reduce build time, install latexpand v1.3 in docker images.

Also add Dockerfile.bionic, which is based on ubuntu:bionic and add a couple of up-to-date LaTeX packages and a2ping under /usr/local/share and /usr/local/bin.

Quoted 5 lines

Note: On the host, you can download it from

    https://gitlab.com/latexpand/latexpand/-/archive/v1.3/latexpand-v1.3.tar.gz

, and put it into your own bin directory.

That reduces my build time (after "make clean") from 2m11 to 1m:43, so well worthwhile, thank you!

Queued and pushed, and a big "thank you!!!" on behalf of perfbook dockerfile users everywhere! ;-)

Thanx, Paul

Quoted 88 lines
---
 docker/Dockerfile        |  5 +++++
 docker/Dockerfile.bionic | 40 ++++++++++++++++++++++++++++++++++++++++
 docker/Dockerfile.fedora |  4 ++++
 3 files changed, 49 insertions(+)
 create mode 100644 docker/Dockerfile.bionic
docker/Dockerfile +5 -0
index a5afe6ea..7527e08b 100644
@@ -12,6 +12,11 @@ RUN apt-get update && apt-get install -y fig2ps inkscape xfig graphviz psutils \
     rm -rf /var/lib/apt/lists/*
 COPY steel-city-comic.regular.ttf /usr/local/share/fonts/
 RUN fc-cache /usr/local/share/fonts/
+RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
+WORKDIR /opt
+RUN curl https://gitlab.com/latexpand/latexpand/-/archive/v1.3/latexpand-v1.3.tar.gz -o - | tar xfz - && \
+    sed -i -e 's/@LATEXPAND_VERSION@/v1.3/' latexpand-v1.3/latexpand && \
+    cp latexpand-v1.3/latexpand /usr/local/bin
 ARG uid=1000
 ARG gid=1000
 ARG user=perfbook
docker/Dockerfile.bionic new file +40 -0
new file mode 100644
index 00000000..56e6280e
@@ -0,0 +1,40 @@
+FROM ubuntu:bionic
+
+RUN apt-get update && apt-get install -y locales && \
+    localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 && \
+    rm -rf /var/lib/apt/lists/*
+ENV LANG en_US.utf8
+RUN apt-get update && DEBIAN_FRONTEND=noninteractive TZ=UTC apt-get install -y tzdata && \
+    rm -rf /var/lib/apt/lists/*
+RUN apt-get update && apt-get install -y fig2ps inkscape xfig graphviz psutils \
+    texlive-publishers texlive-pstricks texlive-science texlive-fonts-extra \
+    make nano vim git && \
+    rm -rf /var/lib/apt/lists/*
+COPY steel-city-comic.regular.ttf /usr/local/share/fonts/
+RUN fc-cache /usr/local/share/fonts/
+RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
+WORKDIR /opt
+RUN curl https://mirrors.ctan.org/macros/latex/contrib/cleveref.zip -L -O && unzip cleveref.zip && \
+    curl https://mirrors.ctan.org/macros/latex/contrib/epigraph.zip -L -O && unzip epigraph.zip && \
+    curl https://mirrors.ctan.org/macros/latex/contrib/glossaries-extra.zip -L -O && unzip glossaries-extra.zip && \
+    cd cleveref; latex cleveref.ins; cd .. && \
+    mkdir -p /usr/local/share/texmf/tex/latex/cleveref && \
+    cp cleveref/cleveref.sty /usr/local/share/texmf/tex/latex/cleveref && \
+    cd epigraph; latex epigraph.ins; cd .. && \
+    mkdir -p /usr/local/share/texmf/tex/latex/epigraph && \
+    cp epigraph/epigraph.sty /usr/local/share/texmf/tex/latex/epigraph && \
+    cd glossaries-extra; latex glossaries-extra.ins; cd .. && \
+    mkdir -p /usr/local/share/texmf/tex/latex/glossaries-extra && \
+    cp glossaries-extra/*.sty /usr/local/share/texmf/tex/latex/glossaries-extra && \
+    texhash /usr/local/share/texmf && \
+    curl https://mirrors.ctan.org/graphics/a2ping.zip -L -O && unzip a2ping.zip && \
+    cp a2ping/a2ping.pl /usr/local/bin/a2ping
+ARG uid=1000
+ARG gid=1000
+ARG user=perfbook
+ARG group=perfbook
+RUN groupadd -g $gid $group && useradd -u $uid -g $gid -m $user
+VOLUME /work
+USER $uid:$gid
+WORKDIR /work
+CMD /bin/bash
docker/Dockerfile.fedora +4 -0
index 4a3ab855..33add84d 100644
@@ -10,6 +10,10 @@ RUN dnf -y update && dnf install -y --setopt=tsflags=nodocs \
     mktexlsr
 COPY steel-city-comic.regular.ttf /usr/local/share/fonts/
 RUN fc-cache /usr/local/share/fonts/
+WORKDIR /opt
+RUN curl https://gitlab.com/latexpand/latexpand/-/archive/v1.3/latexpand-v1.3.tar.gz -o - | tar xfz - && \
+    sed -i -e 's/@LATEXPAND_VERSION@/v1.3/' latexpand-v1.3/latexpand && \
+    cp latexpand-v1.3/latexpand /usr/local/bin
 ARG uid=1000
 ARG gid=1000
 ARG user=perfbook
Signature · 1 line
2.17.1