-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.cn_point_release_image
153 lines (141 loc) · 6.28 KB
/
Dockerfile.cn_point_release_image
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
FROM debian:11
ENV LANG=C.UTF-8 \
LC_ALL=C.UTF-8 \
# ConTeXt cache can be created on runtime and does not need to
# increase image size
TEXLIVE_INSTALL_NO_CONTEXT_CACHE=1 \
# As we will not install regular documentation why would we want to
# install perl docs…
NOPERLDOC=1
COPY ./debian-cn-mirror.txt /etc/apt/sources.list
RUN apt-get update && \
# basic utilities for TeX Live installation
apt-get install -qy --no-install-recommends curl git unzip \
# miscellaneous dependencies for TeX Live tools
make fontconfig perl default-jre libgetopt-long-descriptive-perl \
libdigest-perl-md5-perl libncurses5 libncurses6 \
# for latexindent (see #13)
libunicode-linebreak-perl libfile-homedir-perl libyaml-tiny-perl \
# for eps conversion (see #14)
ghostscript \
# for metafont (see #24)
libsm6 \
# for syntax highlighting
python3 python3-pygments \
# for gnuplot backend of pgfplots (see !13)
gnuplot-nox \
equivs \
# at this point also install gpg and gpg-agent to allow tlmgr's
# key subcommand to work correctly (see #21)
gpg gpg-agent \
# we install using rsync so we need to have it installed
rsync && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /var/cache/apt/ && \
# bad fix for python handling
ln -s /usr/bin/python3 /usr/bin/python
# whether to install documentation and/or source files
# this has to be yes or no
ARG DOCFILES=no
ARG SRCFILES=no
ARG SCHEME=full
# the mirror from which we will download TeX Live: in cn
ARG TLMIRRORURL="rsync://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/tlnet/"
# whether to create font and ConTeXt caches
ARG GENERATE_CACHES=yes
WORKDIR /tmp
# download and install equivs file for dummy package
RUN curl https://tug.org/texlive/files/debian-equivs-2022-ex.txt --output texlive-local && \
sed -i "s/2022/9999/" texlive-local && \
# freeglut3 does not ship with debian testing, so we remove it because there
# is no GUI need in the container anyway (see #28)
sed -i "/Depends: freeglut3/d" texlive-local && \
# apt-get update && \
# # Mark all texlive packages as installed. This enables installing
# # latex-related packges in child images.
# # Inspired by https://tex.stackexchange.com/a/95373/9075.
# apt-get install -qy --no-install-recommends equivs \
# # at this point also install gpg and gpg-agent to allow tlmgr's
# # key subcommand to work correctly (see #21)
# gpg gpg-agent \
# # we install using rsync so we need to have it installed
# rsync && \
# rm -rf /var/lib/apt/lists/* && \
# apt-get clean && \
# rm -rf /var/cache/apt/
# we need to change into tl-equis to get it working
equivs-build texlive-local && \
dpkg -i texlive-local_9999.99999999-1_all.deb && \
apt-get install -qyf --no-install-recommends && \
# reverse the cd command from above and cleanup
rm -rf ./*texlive* && \
# save some space
apt-get remove -y --purge equivs && \
apt-get autoremove -qy --purge && \
rm -rf /var/lib/apt/lists/* && \
apt-get clean && \
rm -rf /var/cache/apt/
RUN echo "Fetching installation from mirror $TLMIRRORURL" && \
rsync -a --stats "$TLMIRRORURL" texlive && \
cd texlive && \
# create installation profile for full scheme installation with
# the selected options
echo "Building with documentation: $DOCFILES" && \
echo "Building with sources: $SRCFILES" && \
echo "Building with scheme: $SCHEME" && \
# choose complete installation
echo "selected_scheme scheme-$SCHEME" > install.profile && \
# … but disable documentation and source files when asked to stay slim
if [ "$DOCFILES" = "no" ]; then echo "tlpdbopt_install_docfiles 0" >> install.profile && \
echo "BUILD: Disabling documentation files"; fi && \
if [ "$SRCFILES" = "no" ]; then echo "tlpdbopt_install_srcfiles 0" >> install.profile && \
echo "BUILD: Disabling source files"; fi && \
echo "tlpdbopt_autobackup 0" >> install.profile && \
# furthermore we want our symlinks in the system binary folder to avoid
# fiddling around with the PATH
echo "tlpdbopt_sys_bin /usr/bin" >> install.profile && \
# actually install TeX Live
./install-tl -profile install.profile && \
cd .. && \
rm -rf texlive
WORKDIR /
RUN echo "Set PATH to $PATH" && \
$(find /usr/local/texlive -name tlmgr) path add && \
# Temporary fix for ConTeXt (#30)
(sed -i '/package.loaded\["data-ini"\]/a if os.selfpath then environment.ownbin=lfs.symlinktarget(os.selfpath..io.fileseparator..os.selfname);environment.ownpath=environment.ownbin:match("^.*"..io.fileseparator) else environment.ownpath=kpse.new("luatex"):var_value("SELFAUTOLOC");environment.ownbin=environment.ownpath..io.fileseparator..(arg[-2] or arg[-1] or arg[0] or "luatex"):match("[^"..io.fileseparator.."]*$") end' /usr/bin/mtxrun.lua || true) && \
# pregenerate caches as per #3; overhead is < 5 MB which does not really
# matter for images in the sizes of GBs; some TL schemes might not have
# all the tools, therefore failure is allowed
# make cn great
tlmgr option repository https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/tlnet && \
if [ "$GENERATE_CACHES" = "yes" ]; then \
echo "Generating caches and ConTeXt files" && \
(luaotfload-tool -u || true) && \
# also generate fontconfig cache as per #18 which is approx. 20 MB but
# benefits XeLaTeX user to load fonts from the TL tree by font name
(cp "$(find /usr/local/texlive -name texlive-fontconfig.conf)" /etc/fonts/conf.d/09-texlive-fonts.conf || true) && \
fc-cache -fsv && \
if [ -f "/usr/bin/context" ]; then \
mtxrun --generate && \
texlua /usr/bin/mtxrun.lua --luatex --generate && \
context --make && \
context --luatex --make; \
fi \
else \
echo "Not generating caches or ConTeXt files"; \
fi
RUN \
# test the installation; we only test the full installation because
# in that, all tools are present and have to work
if [ "$SCHEME" = "full" ]; then \
latex --version && printf '\n' && \
biber --version && printf '\n' && \
xindy --version && printf '\n' && \
arara --version && printf '\n' && \
context --version && printf '\n' && \
context --luatex --version && printf '\n' && \
if [ "$DOCFILES" = "yes" ]; then texdoc -l geometry; fi && \
if [ "$SRCFILES" = "yes" ]; then kpsewhich amsmath.dtx; fi; \
fi && \
python --version && printf '\n' && \
pygmentize -V && printf '\n'