YoBatM commited on
Commit
1733bfc
·
verified ·
1 Parent(s): d32fec6

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +110 -1
Dockerfile CHANGED
@@ -1,4 +1,113 @@
1
- FROM registry.gitlab.com/islandoftex/images/texlive:latest
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  FROM python:3.10
3
  # Set up a new user named "user" with user ID 1000
4
  RUN useradd -m -u 1000 user
 
1
+ FROM registry.gitlab.com/islandoftex/images/texlive:base
2
+
3
+ # whether to install documentation and/or source files
4
+ # this has to be yes or no
5
+ ARG DOCFILES=no
6
+ ARG SRCFILES=no
7
+ ARG SCHEME=full
8
+
9
+ # the mirror from which we will download TeX Live
10
+ ARG TLMIRRORURL
11
+
12
+ # whether to create font and ConTeXt caches
13
+ ARG GENERATE_CACHES=yes
14
+
15
+ WORKDIR /tmp
16
+
17
+ # download and install equivs file for dummy package
18
+ RUN curl https://tug.org/texlive/files/debian-equivs-2022-ex.txt --output texlive-local && \
19
+ sed -i "s/2022/9999/" texlive-local && \
20
+ # freeglut3 does not ship with debian testing, so we remove it because there
21
+ # is no GUI need in the container anyway (see #28)
22
+ sed -i "/Depends: freeglut3/d" texlive-local && \
23
+ apt-get update && \
24
+ # Mark all texlive packages as installed. This enables installing
25
+ # latex-related packges in child images.
26
+ # Inspired by https://tex.stackexchange.com/a/95373/9075.
27
+ apt-get install -qy --no-install-recommends equivs \
28
+ # at this point also install gpg and gpg-agent to allow tlmgr's
29
+ # key subcommand to work correctly (see #21)
30
+ gpg gpg-agent \
31
+ # we install using rsync so we need to have it installed
32
+ rsync && \
33
+ # we need to change into tl-equis to get it working
34
+ equivs-build texlive-local && \
35
+ dpkg -i texlive-local_9999.99999999-1_all.deb && \
36
+ apt-get install -qyf --no-install-recommends && \
37
+ # reverse the cd command from above and cleanup
38
+ rm -rf ./*texlive* && \
39
+ # save some space
40
+ apt-get remove -y --purge equivs && \
41
+ apt-get autoremove -qy --purge && \
42
+ rm -rf /var/lib/apt/lists/* && \
43
+ apt-get clean && \
44
+ rm -rf /var/cache/apt/
45
+
46
+ RUN echo "Fetching installation from mirror $TLMIRRORURL" && \
47
+ rsync -a --stats "$TLMIRRORURL" texlive && \
48
+ cd texlive && \
49
+ # create installation profile for full scheme installation with
50
+ # the selected options
51
+ echo "Building with documentation: $DOCFILES" && \
52
+ echo "Building with sources: $SRCFILES" && \
53
+ echo "Building with scheme: $SCHEME" && \
54
+ # choose complete installation
55
+ echo "selected_scheme scheme-$SCHEME" > install.profile && \
56
+ # … but disable documentation and source files when asked to stay slim
57
+ if [ "$DOCFILES" = "no" ]; then echo "tlpdbopt_install_docfiles 0" >> install.profile && \
58
+ echo "BUILD: Disabling documentation files"; fi && \
59
+ if [ "$SRCFILES" = "no" ]; then echo "tlpdbopt_install_srcfiles 0" >> install.profile && \
60
+ echo "BUILD: Disabling source files"; fi && \
61
+ echo "tlpdbopt_autobackup 0" >> install.profile && \
62
+ # furthermore we want our symlinks in the system binary folder to avoid
63
+ # fiddling around with the PATH
64
+ echo "tlpdbopt_sys_bin /usr/bin" >> install.profile && \
65
+ # actually install TeX Live
66
+ ./install-tl -profile install.profile && \
67
+ cd .. && \
68
+ rm -rf texlive
69
+
70
+ WORKDIR /workdir
71
+ RUN echo "Set PATH to $PATH" && \
72
+ $(find /usr/local/texlive -name tlmgr) path add && \
73
+ # Temporary fix for ConTeXt (#30)
74
+ (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) && \
75
+ # pregenerate caches as per #3; overhead is < 5 MB which does not really
76
+ # matter for images in the sizes of GBs; some TL schemes might not have
77
+ # all the tools, therefore failure is allowed
78
+ if [ "$GENERATE_CACHES" = "yes" ]; then \
79
+ echo "Generating caches and ConTeXt files" && \
80
+ (luaotfload-tool -u || true) && \
81
+ # also generate fontconfig cache as per #18 which is approx. 20 MB but
82
+ # benefits XeLaTeX user to load fonts from the TL tree by font name
83
+ (cp "$(find /usr/local/texlive -name texlive-fontconfig.conf)" /etc/fonts/conf.d/09-texlive-fonts.conf || true) && \
84
+ fc-cache -fsv && \
85
+ if [ -f "/usr/bin/context" ]; then \
86
+ mtxrun --generate && \
87
+ texlua /usr/bin/mtxrun.lua --luatex --generate && \
88
+ context --make && \
89
+ context --luatex --make; \
90
+ fi \
91
+ else \
92
+ echo "Not generating caches or ConTeXt files"; \
93
+ fi
94
+
95
+ RUN \
96
+ # test the installation; we only test the full installation because
97
+ # in that, all tools are present and have to work
98
+ if [ "$SCHEME" = "full" ]; then \
99
+ latex --version && printf '\n' && \
100
+ biber --version && printf '\n' && \
101
+ xindy --version && printf '\n' && \
102
+ arara --version && printf '\n' && \
103
+ context --version && printf '\n' && \
104
+ context --luatex --version && printf '\n' && \
105
+ if [ "$DOCFILES" = "yes" ]; then texdoc -l geometry; fi && \
106
+ if [ "$SRCFILES" = "yes" ]; then kpsewhich amsmath.dtx; fi; \
107
+ fi && \
108
+ python --version && printf '\n' && \
109
+ pygmentize -V && printf '\n'
110
+
111
  FROM python:3.10
112
  # Set up a new user named "user" with user ID 1000
113
  RUN useradd -m -u 1000 user