最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

dockerfile - Error while building LaTeX on Docker Alpine on M3 Max chip (arm64aarch64): Quitting, no binary platform specifiedav

programmeradmin4浏览0评论

Background

I am trying to dockerize my LaTeX distribution using Alpine on my MacBook Pro with an M3 Max chip.

Dockerfile

FROM alpine:3.21
ENV PATH=/usr/local/texlive/bin/aarch64-linuxmusl:$PATH
ARG TL_MIRROR=
WORKDIR /data
COPY texlive.profile /tmp/
RUN apk add --no-cache perl wget && \
    wget $TL_MIRROR/install-tl-unx.tar.gz && \
    mkdir /tmp/install-tl && \
    tar -xzf install-tl-unx.tar.gz -C /tmp/install-tl --strip-components=1 && \
    /tmp/install-tl/install-tl --profile=/tmp/texlive.profile && \
    tlmgr update --self && \
    tlmgr option repository $TL_MIRROR && \
    tlmgr install \
      biber \
      biblatex \
      bookmark \
      booktabs \
      ellipsis \
      enumitem \
      fbb \
      fontawesome \
      hyperref \
      kpfonts \
      l3packages \
      latex \
      latex-bin \
      latex-tools-dev \
      latexmk \
      listings \
      ly1 \
      mathtools \
      memoir \
      microtype \
      nth \
      pgfplots \
      thmtools \
      ulem \
      xcolor \
      xfrac \
      xkeyval \
      xpatch \
      xstring && \
    apk del --no-cache wget && \
    rm -rf \
      /var/cache/apk/* \
      /var/lib/apt/lists/* \
      /tmp/* \
      /var/tmp/* \
      install-tl-unx.tar.gz

texlive.profile

selected_scheme scheme-minimal
TEXDIR /usr/local/texlive
TEXMFCONFIG ~/.texlive/texmf-config
TEXMFHOME ~/texmf
TEXMFLOCAL /usr/local/texlive/texmf-local
TEXMFSYSCONFIG /usr/local/texlive/texmf-config
TEXMFSYSVAR /usr/local/texlive/texmf-var
TEXMFVAR ~/.texlive/texmf-var
tlpdbopt_install_docfiles 0
tlpdbopt_install_srcfiles 0

Problem

When I try to build the image, I get an error: /tmp/install-tl/install-tl: Quitting, no binary platform specified/available.

In the first two lines, I have tried various permutations, e.g.:

FROM alpine:3.21
FROM arm64v8/alpine:3.21

and

ENV PATH=/usr/local/texlive/bin/aarch64-linuxmusl:$PATH
ENV PATH=/usr/local/texlive/bin/arm64-linuxmusl:$PATH
ENV PATH=/usr/local/texlive/bin/aarch64-linux:$PATH
ENV PATH=/usr/local/texlive/bin/arm64-linux:$PATH

But the error remains.

Note that using amd64/x86_64 works:

FROM --platform=linux/amd64 alpine:3.21
ENV PATH=/usr/local/texlive/bin/x86_64-linuxmusl:$PATH

Question

What is the best way to dockerize my LaTeX distribution on aarch64?

Background

I am trying to dockerize my LaTeX distribution using Alpine on my MacBook Pro with an M3 Max chip.

Dockerfile

FROM alpine:3.21
ENV PATH=/usr/local/texlive/bin/aarch64-linuxmusl:$PATH
ARG TL_MIRROR=https://mirror.init7.net/ctan/systems/texlive/tlnet
WORKDIR /data
COPY texlive.profile /tmp/
RUN apk add --no-cache perl wget && \
    wget $TL_MIRROR/install-tl-unx.tar.gz && \
    mkdir /tmp/install-tl && \
    tar -xzf install-tl-unx.tar.gz -C /tmp/install-tl --strip-components=1 && \
    /tmp/install-tl/install-tl --profile=/tmp/texlive.profile && \
    tlmgr update --self && \
    tlmgr option repository $TL_MIRROR && \
    tlmgr install \
      biber \
      biblatex \
      bookmark \
      booktabs \
      ellipsis \
      enumitem \
      fbb \
      fontawesome \
      hyperref \
      kpfonts \
      l3packages \
      latex \
      latex-bin \
      latex-tools-dev \
      latexmk \
      listings \
      ly1 \
      mathtools \
      memoir \
      microtype \
      nth \
      pgfplots \
      thmtools \
      ulem \
      xcolor \
      xfrac \
      xkeyval \
      xpatch \
      xstring && \
    apk del --no-cache wget && \
    rm -rf \
      /var/cache/apk/* \
      /var/lib/apt/lists/* \
      /tmp/* \
      /var/tmp/* \
      install-tl-unx.tar.gz

texlive.profile

selected_scheme scheme-minimal
TEXDIR /usr/local/texlive
TEXMFCONFIG ~/.texlive/texmf-config
TEXMFHOME ~/texmf
TEXMFLOCAL /usr/local/texlive/texmf-local
TEXMFSYSCONFIG /usr/local/texlive/texmf-config
TEXMFSYSVAR /usr/local/texlive/texmf-var
TEXMFVAR ~/.texlive/texmf-var
tlpdbopt_install_docfiles 0
tlpdbopt_install_srcfiles 0

Problem

When I try to build the image, I get an error: /tmp/install-tl/install-tl: Quitting, no binary platform specified/available.

In the first two lines, I have tried various permutations, e.g.:

FROM alpine:3.21
FROM arm64v8/alpine:3.21

and

ENV PATH=/usr/local/texlive/bin/aarch64-linuxmusl:$PATH
ENV PATH=/usr/local/texlive/bin/arm64-linuxmusl:$PATH
ENV PATH=/usr/local/texlive/bin/aarch64-linux:$PATH
ENV PATH=/usr/local/texlive/bin/arm64-linux:$PATH

But the error remains.

Note that using amd64/x86_64 works:

FROM --platform=linux/amd64 alpine:3.21
ENV PATH=/usr/local/texlive/bin/x86_64-linuxmusl:$PATH

Question

What is the best way to dockerize my LaTeX distribution on aarch64?

Share Improve this question asked Jan 20 at 17:36 anti-destinanti-destin 8691 gold badge9 silver badges20 bronze badges 2
  • (TeX works principally on local files; to do anything with it at all, you'll need a long-winded docker run command that included a -v option to make the current directory visible to the container plus a -u option to set the appropriate user ID, and potentially run it as sudo if your local environment requires it to run containers [nothing stops -v any directory plus -u root]. Can you use your host OS package manager to install TeX instead?) – David Maze Commented Jan 20 at 22:26
  • Yes, I wrote a vim function to run that long docker run command in a hidden terminal. One of my primary reasons to dockerize my LaTeX distribution is to avoid cluttering my host system. – anti-destin Commented Jan 21 at 17:14
Add a comment  | 

1 Answer 1

Reset to default 0

I managed to resolve the issue by using a custom binary set as follows:

  1. Install xz.
  2. Download aarch64-alpine319.tar.xz.
  3. Ensure that wget and xz are available in the PATH so that Tex Live can later download and decompress packages.
  4. Install Tex Live using the custom binary set: https://tug.org/texlive/custom-bin.html.

Dockerfile

FROM alpine:3.21
ENV PATH=/usr/local/texlive/bin/custom:$PATH
ARG TL_MIRROR=https://mirror.init7.net/ctan/systems/texlive/tlnet
WORKDIR /data
COPY texlive.profile /tmp/
RUN apk add --no-cache perl wget xz && \
    wget https://ftp.math.utah.edu/pub/texlive-utah/bin/aarch64-alpine319.tar.xz && \
    mkdir /tmp/custombin && \
    tar -xvf aarch64-alpine319.tar.xz -C /tmp/custombin --strip-components=1 && \
    cp /usr/bin/wget /usr/bin/xz /tmp/custombin && \
    wget $TL_MIRROR/install-tl-unx.tar.gz && \
    mkdir /tmp/install-tl && \
    tar -xvf install-tl-unx.tar.gz -C /tmp/install-tl --strip-components=1 && \
    /tmp/install-tl/install-tl --custom-bin=/tmp/custombin --profile=/tmp/texlive.profile && \
    tlmgr update --self && \
    tlmgr option repository $TL_MIRROR && \
    tlmgr install \
      biber \
      biblatex \
      bookmark \
      booktabs \
      ellipsis \
      enumitem \
      fbb \
      fontawesome \
      hyperref \
      kpfonts \
      l3packages \
      latex \
      latex-bin \
      latex-tools-dev \
      latexmk \
      listings \
      ly1 \
      mathtools \
      memoir \
      microtype \
      nth \
      pgfplots \
      thmtools \
      ulem \
      xcolor \
      xfrac \
      xkeyval \
      xpatch \
      xstring && \
    apk del --no-cache wget xz && \
    rm -rf \
      /var/cache/apk/* \
      /var/lib/apt/lists/* \
      /tmp/* \
      /var/tmp/* \
      aarch64-alpine319.tar.xz \
      install-tl-unx.tar.gz

This image works, and I can compile as expected.

The only issue is that the resulting image is 445 MB whereas the x86_64 version was around 250 MB.

I am now using the Docker extension Dive-In to investigate the image further.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论