-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
122 lines (112 loc) · 4.79 KB
/
Dockerfile
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
## Dockerfile for latexml-plugin-cortex, using the latest LaTeXML
##
## The Docker Image starts the harness on all available CPUs for the container
## accepting the address and port of the CorTeX job dispatcher
##
## build via:
##
## export HOSTNAME=$(hostname); export HOSTTIME=$(date -Iminute);
## docker build --build-arg HOSTNAME=$HOSTNAME --build-arg HOSTTIME=$HOSTTIME --tag latexml-plugin-cortex:2.1 .
##
## run example via:
##
##
## 1. threadripper 1950x
## docker run --cpus="24.0" --memory="48g" --shm-size="32g" --hostname=$(hostname) latexml-plugin-cortex:2.1 latexml_harness 131.188.48.209
##
## 2. monster config style:
## docker run --cpus="72.0" --memory="96g" --shm-size="64g" --hostname=$(hostname) latexml-plugin-cortex:2.1 latexml_harness 131.188.48.209
FROM ubuntu:22.04
ENV TZ=America/New_York
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
ARG HOSTNAME
ENV DOCKER_HOST=$HOSTNAME
# LaTeX stuff first, because it's enormous and doesn't change much
RUN set -ex && apt-get update -qq && apt-get install -qy \
texlive \
texlive-fonts-extra \
texlive-lang-all \
texlive-latex-extra \
texlive-bibtex-extra \
texlive-science \
texlive-pictures \
texlive-pstricks \
texlive-publishers
# latexml dependencies
RUN set -ex && apt-get update -qq && apt-get install -qy \
build-essential \
git \
imagemagick \
libarchive-zip-perl \
libdb-dev \
libfile-which-perl \
libimage-magick-perl \
libimage-size-perl \
libio-string-perl \
libjson-xs-perl \
libparse-recdescent-perl \
libtext-unidecode-perl \
liburi-perl \
libuuid-tiny-perl \
libwww-perl \
libxml-libxml-perl \
libxml-libxslt-perl \
libxml2 libxml2-dev \
libxslt1-dev \
libxslt1.1 \
liblocal-lib-perl \
make \
perl-doc \
cpanminus
# make sure perl paths are OK
RUN eval $(perl -I$HOME/perl5/lib -Mlocal::lib)
RUN echo 'eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)"' >> ~/.bashrc
# Collect the extended ar5iv-bindings files
ENV AR5IV_BINDINGS_COMMIT=31337a41074d36750987824b7369ef9e215c4df4
ENV AR5IV_BINDINGS_BASE=/opt/ar5iv-bindings
ENV AR5IV_BINDINGS_PATH=$AR5IV_BINDINGS_BASE/bindings
ENV AR5IV_SUPPORTED_ORIGINALS_PATH=$AR5IV_BINDINGS_BASE/supported_originals
RUN rm -rf $AR5IV_BINDINGS_BASE ; mkdir -p $AR5IV_BINDINGS_BASE
RUN git clone https://github.com/dginev/ar5iv-bindings $AR5IV_BINDINGS_BASE
WORKDIR $AR5IV_BINDINGS_BASE
RUN git reset --hard $AR5IV_BINDINGS_COMMIT
# Install LaTeXML, at a fixed commit, via cpanminus
RUN export HARNESS_OPTIONS=j$(grep -c ^processor /proc/cpuinfo):c
RUN mkdir -p /opt/latexml
WORKDIR /opt/latexml
ENV LATEXML_COMMIT=741814152d386230770c1300f66c248458279b49
RUN cpanm --notest --verbose https://github.com/brucemiller/LaTeXML/tarball/$LATEXML_COMMIT
# cortex worker dependencies
RUN set -ex && apt-get update -qq && apt-get install -qy \
libarchive-zip-perl \
libcapture-tiny-perl \
libdevel-checklib-perl \
libio-all-perl \
libproc-processtable-perl \
libtask-weaken-perl \
libtest-fatal-perl \
libtest-requires-perl \
libtest-sharedfork-perl \
libtest-tcp-perl \
libtest-weaken-perl \
libunix-processors-perl \
libzmq3-dev
# Enable imagemagick policy permissions for work with arXiv PDF/EPS files
RUN perl -pi.bak -e 's/rights="none" pattern="([XE]?PS\d?|PDF)"/rights="read|write" pattern="$1"/g' /etc/ImageMagick-6/policy.xml
# Extend imagemagick resource allowance to be able to create with high-quality images
RUN perl -pi.bak -e 's/policy domain="resource" name="width" value="(\w+)"/policy domain="resource" name="width" value="126KP"/' /etc/ImageMagick-6/policy.xml
RUN perl -pi.bak -e 's/policy domain="resource" name="height" value="(\w+)"/policy domain="resource" name="height" value="126KP"/' /etc/ImageMagick-6/policy.xml
RUN perl -pi.bak -e 's/policy domain="resource" name="area" value="(\w+)"/policy domain="resource" name="area" value="2GiB"/' /etc/ImageMagick-6/policy.xml
RUN perl -pi.bak -e 's/policy domain="resource" name="disk" value="(\w+)"/policy domain="resource" name="disk" value="8GiB"/' /etc/ImageMagick-6/policy.xml
RUN perl -pi.bak -e 's/policy domain="resource" name="memory" value="(\w+)"/policy domain="resource" name="memory" value="2GiB"/' /etc/ImageMagick-6/policy.xml
RUN perl -pi.bak -e 's/policy domain="resource" name="map" value="(\w+)"/policy domain="resource" name="map" value="2GiB"/' /etc/ImageMagick-6/policy.xml
# Install LaTeXML-Plugin-Cortex, at a fixed commit, via cpanminus
ARG HOSTTIME
ENV DOCKER_BUILD_TIME=$HOSTTIME
ENV WORKING_DIR=/opt/latexml_plugin_cortex
RUN if [ -d "$WORKING_DIR" ]; then rm -Rf $WORKING_DIR; fi
RUN mkdir -p $WORKING_DIR
WORKDIR $WORKING_DIR
ENV CORTEX_WORKER_COMMIT=353a6c504305b26de9b484b749ca8b4629b6c5ad
RUN cpanm --verbose https://github.com/dginev/LaTeXML-Plugin-Cortex/tarball/$CORTEX_WORKER_COMMIT
RUN echo "Build started at $DOCKER_BUILD_TIME, ended at $(date -Iminute)"