Skip to content

Commit c30e035

Browse files
committed
Add texlive Dockerfile
* Original Dockerfile is : http://github.com/thomasWeise/docker-texlive-full/
1 parent 8ed79f0 commit c30e035

File tree

4 files changed

+264
-0
lines changed

4 files changed

+264
-0
lines changed

texlive/Dockerfile

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
#
2+
# thomasweise/docker-texlive-full
3+
#
4+
# This is an image with a full TeX Live installation and several
5+
# fonts and tools.
6+
# Source: http://github.com/thomasWeise/docker-texlive-full/
7+
# License: GNU GENERAL PUBLIC LICENSE, Version 3, 29 June 2007
8+
# The license applies to the way the image is built, while the
9+
# software components inside the image are under the respective
10+
# licenses chosen by their respective copyright holders.
11+
#
12+
FROM ubuntu:20.04
13+
MAINTAINER Thomas Weise <[email protected]>
14+
15+
ENV LANG=C.UTF-8
16+
ENV DEBIAN_FRONTEND=noninteractive
17+
18+
RUN apt-get update &&\
19+
# prevent doc and man pages from being installed
20+
# the idea is based on https://askubuntu.com/questions/129566
21+
printf 'path-exclude /usr/share/doc/*\npath-include /usr/share/doc/*/copyright\npath-exclude /usr/share/man/*\npath-exclude /usr/share/groff/*\npath-exclude /usr/share/info/*\npath-exclude /usr/share/lintian/*\npath-exclude /usr/share/linda/*\npath-exclude=/usr/share/locale/*' > /etc/dpkg/dpkg.cfg.d/01_nodoc &&\
22+
# remove doc files and man pages already installed
23+
rm -rf /usr/share/groff/* /usr/share/info/* &&\
24+
rm -rf /usr/share/lintian/* /usr/share/linda/* /var/cache/man/* &&\
25+
rm -rf /usr/share/man &&\
26+
mkdir -p /usr/share/man &&\
27+
find /usr/share/doc -depth -type f ! -name copyright -delete &&\
28+
find /usr/share/doc -type f -name "*.pdf" -delete &&\
29+
find /usr/share/doc -type f -name "*.gz" -delete &&\
30+
find /usr/share/doc -type f -name "*.tex" -delete &&\
31+
find /usr/share/doc -type d -empty -delete || true &&\
32+
mkdir -p /usr/share/doc &&\
33+
mkdir -p /usr/share/info &&\
34+
# install utilities
35+
apt-get install -f -y --no-install-recommends apt-utils &&\
36+
# get and update certificates, to hopefully resolve mscorefonts error
37+
apt-get install -f -y --no-install-recommends ca-certificates &&\
38+
update-ca-certificates &&\
39+
# install some utilitites and nice fonts, e.g., for chinese and other
40+
apt-get install -f -y --no-install-recommends \
41+
curl \
42+
emacs-intl-fonts \
43+
fontconfig \
44+
fonts-arphic-bkai00mp \
45+
fonts-arphic-bsmi00lp \
46+
fonts-arphic-gbsn00lp \
47+
fonts-arphic-gkai00mp \
48+
fonts-arphic-ukai \
49+
fonts-arphic-uming \
50+
fonts-dejavu \
51+
fonts-dejavu-core \
52+
fonts-dejavu-extra \
53+
fonts-droid-fallback \
54+
fonts-guru \
55+
fonts-guru-extra \
56+
fonts-liberation \
57+
fonts-noto-cjk \
58+
fonts-opensymbol \
59+
fonts-roboto \
60+
fonts-roboto-hinted \
61+
fonts-stix \
62+
fonts-symbola \
63+
fonts-texgyre \
64+
fonts-unfonts-core \
65+
ttf-wqy-microhei \
66+
ttf-wqy-zenhei \
67+
xfonts-intl-chinese \
68+
xfonts-intl-chinese-big \
69+
xfonts-wqy &&\
70+
# now the microsoft core fonts
71+
echo "ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true" | debconf-set-selections &&\
72+
echo "ttf-mscorefonts-installer msttcorefonts/present-mscorefonts-eula note" | debconf-set-selections &&\
73+
curl --output "/tmp/ttf-mscorefonts-installer.deb" "http://ftp.de.debian.org/debian/pool/contrib/m/msttcorefonts/ttf-mscorefonts-installer_3.7_all.deb" &&\
74+
apt install -f -y --no-install-recommends "/tmp/ttf-mscorefonts-installer.deb" || true &&\
75+
rm -f "/tmp/ttf-mscorefonts-installer.deb" &&\
76+
# we make sure to contain the EULA in our container
77+
curl --output "/root/mscorefonts-eula" "http://corefonts.sourceforge.net/eula.htm" &&\
78+
# install TeX Live and ghostscript as well as other tools
79+
apt-get install -f -y --no-install-recommends \
80+
cm-super \
81+
dvipng \
82+
ghostscript \
83+
make \
84+
latex-cjk-all \
85+
latex-cjk-common \
86+
latex-cjk-chinese \
87+
latexmk \
88+
lcdf-typetools \
89+
lmodern \
90+
poppler-utils \
91+
psutils \
92+
purifyeps \
93+
t1utils \
94+
tex-gyre \
95+
tex4ht \
96+
texlive-base \
97+
texlive-bibtex-extra \
98+
texlive-binaries \
99+
texlive-extra-utils \
100+
texlive-font-utils \
101+
texlive-fonts-extra \
102+
texlive-fonts-extra-links \
103+
texlive-fonts-recommended \
104+
texlive-formats-extra \
105+
texlive-lang-all \
106+
texlive-lang-chinese \
107+
texlive-lang-cjk \
108+
texlive-latex-base \
109+
texlive-latex-extra \
110+
texlive-latex-recommended \
111+
texlive-luatex \
112+
texlive-metapost \
113+
texlive-pictures \
114+
texlive-plain-generic \
115+
texlive-pstricks \
116+
texlive-publishers \
117+
texlive-science \
118+
texlive-xetex \
119+
texlive-bibtex-extra &&\
120+
# delete texlive sources and other potentially useless stuff
121+
rm -rf /usr/share/texmf/source || true &&\
122+
rm -rf /usr/share/texlive/texmf-dist/source || true &&\
123+
find /usr/share/texlive -type f -name "readme*.*" -delete &&\
124+
find /usr/share/texlive -type f -name "README*.*" -delete &&\
125+
rm -rf /usr/share/texlive/release-texlive.txt || true &&\
126+
rm -rf /usr/share/texlive/doc.html || true &&\
127+
rm -rf /usr/share/texlive/index.html || true &&\
128+
# update font cache
129+
fc-cache -fv &&\
130+
# clean up all temporary files
131+
apt-get clean -y &&\
132+
rm -rf /var/lib/apt/lists/* &&\
133+
rm -f /etc/ssh/ssh_host_* &&\
134+
# delete man pages and documentation
135+
rm -rf /usr/share/man &&\
136+
mkdir -p /usr/share/man &&\
137+
find /usr/share/doc -depth -type f ! -name copyright -delete &&\
138+
find /usr/share/doc -type f -name "*.pdf" -delete &&\
139+
find /usr/share/doc -type f -name "*.gz" -delete &&\
140+
find /usr/share/doc -type f -name "*.tex" -delete &&\
141+
find /usr/share/doc -type d -empty -delete || true &&\
142+
mkdir -p /usr/share/doc &&\
143+
rm -rf /var/cache/apt/archives &&\
144+
mkdir -p /var/cache/apt/archives &&\
145+
rm -rf /tmp/* /var/tmp/* &&\
146+
find /usr/share/ -type f -empty -delete || true &&\
147+
find /usr/share/ -type d -empty -delete || true &&\
148+
mkdir -p /usr/share/texmf/source &&\
149+
mkdir -p /usr/share/texlive/texmf-dist/source
150+
151+
ADD scripts /bin/
152+
153+
ARG CODE_SERVER_VERSION=2.1698-vsc1.41.1-linux-x86_64
154+
COPY ./code-server${CODE_SERVER_VERSION}.tar.gz /tmp/code-server.tar.gz
155+
RUN tar xvzpf /tmp/code-server.tar.gz -C /tmp/
156+
RUN mv /tmp/code-server${CODE_SERVER_VERSION}/code-server /usr/local/bin/code-server
157+
158+
# Backend.AI specifics
159+
LABEL ai.backend.kernelspec="1" \
160+
ai.backend.envs.corecount="OPENBLAS_NUM_THREADS,OMP_NUM_THREADS,NPROC" \
161+
ai.backend.features="batch query uid-match user-input" \
162+
ai.backend.resource.min.cpu="1" \
163+
ai.backend.resource.min.mem="1g" \
164+
ai.backend.base-distro="ubuntu16.04" \
165+
ai.backend.runtime-type="python" \
166+
ai.backend.runtime-path="/usr/bin/python3" \
167+
ai.backend.service-ports="vscode:http:8080"
168+
COPY policy.yml /etc/backend.ai/jail/policy.yml

texlive/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Building docker image
2+
=====================
3+
4+
1. Download visual studio code
5+
* https://github.com/cdr/code-server/releases/download/2.1698/code-server2.1698-vsc1.41.1-linux-x86_64.tar.gz
6+
2. Build docker image

texlive/policy.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
whitelist_paths:
2+
OP_OPEN: ["*"]
3+
OP_ACCESS: ["*"]
4+
OP_EXEC: ["*"]
5+
OP_STAT: ["*"]
6+
OP_CHMOD: ["/home/work/*", "/tmp/*"]
7+
exec_allowance: -1
8+
fork_allowance: -1
9+
max_child_procs: 32
10+
extra_envs: []
11+
preserved_env_keys: [
12+
"HOME", "PATH", "LANG",
13+
"USER", "SHELL", "TERM",
14+
"LD_LIBRARY_PATH",
15+
"LD_PRELOAD",
16+
# Python-specific
17+
"PYTHONPATH",
18+
"PYTHONUNBUFFERED",
19+
"MPLCONFIGDIR",
20+
"OPENBLAS_NUM_THREADS",
21+
]
22+
23+
diff_to_default: true
24+
25+
# Following syscalls are blindly allowed.
26+
# IMPORTANT: ptrace MUST NOT be included!
27+
allowed_syscalls:

texlive/scripts/filterPdf.sh

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/bin/bash -
2+
3+
# This script filters a PDF file and attempts to include as many fonts as possible.
4+
5+
# strict error handling
6+
set -o pipefail # trace ERR through pipes
7+
set -o errtrace # trace ERR through 'time command' and other functions
8+
set -o nounset # set -u : exit the script if you try to use an uninitialized variable
9+
set -o errexit # set -e : exit the script if any statement returns a non-true return value
10+
11+
echo "Filtering document '$1' in order to include as many fonts as possible."
12+
13+
source="$1"
14+
dest="${source%%.*}.pdf"
15+
tempDest="$(tempfile)"
16+
17+
echo "Filtering '$source' to temporary file '$tempDest'."
18+
19+
gs -q -dEmbedAllFonts=true \
20+
-dSubsetFonts=true \
21+
-dCompressFonts=true \
22+
-dOptimize=true \
23+
-dPreserveCopyPage=false \
24+
-dPreserveEPSInfo=false \
25+
-dPreserveHalftoneInfo=false \
26+
-dPreserveOPIComments=false \
27+
-dPreserveOverprintSettings=false \
28+
-dPreserveSeparation=false \
29+
-dPreserveDeviceN=false \
30+
-dMaxBitmap=2147483647 \
31+
-dDownsampleMonoImages=false \
32+
-dDownsampleGrayImages=false \
33+
-dDownsampleColorImages=false \
34+
-dDetectDuplicateImages=true \
35+
-dHaveTransparency=true \
36+
-dFastWebView=false \
37+
-dAutoFilterColorImages=false \
38+
-dAutoFilterGrayImages=false \
39+
-dColorImageFilter=/FlateEncode \
40+
-dGrayImageFilter=/FlateEncode \
41+
-dColorConversionStrategy=/LeaveColorUnchanged \
42+
-dPrinted=false \
43+
-dNOPAUSE \
44+
-dQUIET \
45+
-dBATCH \
46+
-dSAFER \
47+
-sDEVICE=pdfwrite \
48+
-dAutoRotatePages=/PageByPage \
49+
-sOutputFile="$tempDest" "$source" \
50+
-c ".setpdfwrite <</NeverEmbed [ ]>> setdistillerparams"
51+
52+
echo "Finished filtering '$source' to '$tempDest', now checking result."
53+
54+
if pdftotext "$tempDest" &> /dev/null; then
55+
echo "File '$tempDest' has survived a pdftotext check, so we will move it to '$dest'."
56+
mv "$tempDest" "$dest"
57+
chmod 777 "$dest" || true
58+
else
59+
echo "Warning: '$tempDest' is broken according to pdftotext, so we will discard it."
60+
rm -f "$tempDest" || true
61+
fi
62+
63+
echo "Done filtering document '$source'."

0 commit comments

Comments
 (0)