Skip to content

Commit 4baacf7

Browse files
committed
Make Dockerfile arm64 compatible
1 parent af27906 commit 4baacf7

File tree

1 file changed

+26
-7
lines changed

1 file changed

+26
-7
lines changed

Dockerfile

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
FROM alpine:3.20.3
1+
FROM alpine:3.20.3 AS build
22

33
# installation settings
44
ARG TL_MIRROR="https://texlive.info/CTAN/systems/texlive/tlnet"
55

6-
RUN apk add --no-cache perl curl fontconfig libgcc gnupg && \
6+
RUN apk add --no-cache perl curl fontconfig libgcc gnupg xz && \
77
mkdir "/tmp/texlive" && cd "/tmp/texlive" && \
88
wget "$TL_MIRROR/install-tl-unx.tar.gz" && \
99
tar xzvf ./install-tl-unx.tar.gz && \
@@ -18,12 +18,31 @@ RUN apk add --no-cache perl curl fontconfig libgcc gnupg && \
1818
echo "TEXMFSYSVAR /opt/texlive/texmf-var" && \
1919
echo "TEXMFHOME ~/.texmf" \
2020
) > "/tmp/texlive.profile" && \
21-
"./install-tl-"*"/install-tl" --location "$TL_MIRROR" -profile "/tmp/texlive.profile" && \
22-
rm -vf "/opt/texlive/install-tl" && \
23-
rm -vf "/opt/texlive/install-tl.log" && \
24-
rm -vrf /tmp/*
21+
set -eux; cd "/tmp/texlive" && arch=$(uname -m); \
22+
case $arch in \
23+
x86_64) ARCHITECTURE='amd64' ;; \
24+
aarch64) ARCHITECTURE='arm64' ;; \
25+
*) echo >&2 "error: unsupported architecture ($arch)"; exit 1 ;;\
26+
esac; \
27+
echo "Architecture: $ARCHITECTURE"; \
28+
if [ "$ARCHITECTURE" = "amd64" ]; then \
29+
"./install-tl-"*"/install-tl" --location "$TL_MIRROR" -profile "/tmp/texlive.profile" && \
30+
ln -s /opt/texlive/bin/x86_64-linuxmusl /opt/texlive/bin/current; \
31+
fi; \
32+
if [ "$ARCHITECTURE" = "arm64" ]; then \
33+
wget https://ftp.math.utah.edu/pub/texlive-utah/bin/aarch64-alpine319.tar.xz && \
34+
tar xvf aarch64-alpine319.tar.xz && \
35+
"./install-tl-"*"/install-tl" --location "$TL_MIRROR" -profile "/tmp/texlive.profile" --custom-bin=/tmp/texlive/aarch64-alpine319 && \
36+
ln -s /opt/texlive/bin/custom /opt/texlive/bin/current; \
37+
fi;
2538

26-
ENV PATH="${PATH}:/opt/texlive/bin/x86_64-linuxmusl"
39+
FROM alpine:3.20.3 AS final
40+
41+
RUN apk add --no-cache perl curl
42+
43+
COPY --from=build /opt/texlive /opt/texlive
44+
45+
ENV PATH="${PATH}:/opt/texlive/bin/current"
2746

2847
ARG TL_SCHEME_BASIC="y"
2948
RUN if [ "$TL_SCHEME_BASIC" = "y" ]; then tlmgr install scheme-basic; fi

0 commit comments

Comments
 (0)