-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
103 lines (89 loc) · 2.96 KB
/
Copy pathDockerfile
File metadata and controls
103 lines (89 loc) · 2.96 KB
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
## Dockerfile for latexml-plugin-ltxmojo with MathWebSearch support
##
## By default, this image includes only the latexml-plugin-ltxmojo,
## along with hypnotoads. To build this image, use:
##
## > docker build -t latexml-mws .
##
## You can optionally add a full textlive installation to it, by
## setting the `WITH_TEXLIVE` build_arg to "yes":
##
## > docker build -t latexml-mws --build-arg WITH_TEXLIVE=yes .
##
## Building the image this way will take some time, and also make the image
## several gigabytes big.
##
## The Docker Image exposes the web service on port 8080. To run it, use:
##
## docker run -p 8080:8080 --rm latexml-plugin-ltxmojo
# create a 'www-data' user on the standard user id!
FROM alpine:3.13 as permission
ENV USER=www-data
ENV UID=82
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
"${USER}"
# install the actual system
FROM alpine:3.13
# Start by installing the system dependencies
RUN apk add --no-cache \
db-dev \
g++ \
gcc \
gcc \
git \
libc-dev \
libgcrypt \
libgcrypt-dev \
libxml2 \
libxml2-dev \
libxslt \
libxslt-dev \
make \
patch \
perl \
perl-dev \
perl-utils \
wget \
zlib \
zlib-dev
# Optionally enable support for TeXLive
# Use "yes" to enable, "no" to disable
ARG WITH_TEXLIVE="no"
# Install TeXLive if not disabled
RUN [ "$WITH_TEXLIVE" == "no" ] || (\
apk add --no-cache -U --repository http://dl-3.alpinelinux.org/alpine/edge/main poppler harfbuzz-icu \
&& apk add --no-cache -U --repository http://dl-3.alpinelinux.org/alpine/edge/community zziplib texlive-full \
&& ln -s /usr/bin/mktexlsr /usr/bin/mktexlsr.pl \
)
# install cpanminus
RUN apk add --no-cache -U --repository http://dl-3.alpinelinux.org/alpine/edge/community perl-app-cpanminus
# versions of LaTeXML and Mojolicious to install
# accepts anything cpanm-like, by default we simply
# the latest ones
ARG LATEXML_VERSION="LaTeXML"
ARG LATEXML_MWS_VERSION="https://github.com/MathWebSearch/LaTeXML-Plugin-MathWebSearch.git"
ARG LATEXML_ITEX_VERSION="https://github.com/MathWebSearch/LaTeXML-plugin-iTeX2MML.git"
ARG MOJOLICIOUS_VERSION="Mojolicious"
# Add all of the files
RUN mkdir -p /opt/ltxmojo
# Install the plugin via cpanminus
WORKDIR /opt/ltxmojo
RUN git clone https://github.com/dginev/LaTeXML-Plugin-ltxmojo . && cpanm --notest $LATEXML_VERSION $LATEXML_MWS_VERSION $MOJOLICIOUS_VERSION $LATEXML_ITEX_VERSION .
# just another build arg for install other plugins
ARG OTHER_PLUGINS=""
RUN [ "$OTHER_PLUGINS" == "" ] || cpanm $OTHER_PLUGINS .
# so that www-data can create a pidfile
RUN chmod a+w /opt/ltxmojo/script/
# add the user
COPY --from=permission /etc/passwd /etc/passwd
COPY --from=permission /etc/group /etc/group
USER www-data:www-data
# All glory to the hypnotoad on port 8080
EXPOSE 8080
ENTRYPOINT [ "hypnotoad", "-f", "/opt/ltxmojo/script/ltxmojo"]