-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathDockerfile
87 lines (62 loc) · 1.42 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
FROM alpine:3.9
# tinytex dependencies
RUN apk --no-cache add \
perl \
wget \
xz \
tar \
fontconfig \
freetype \
lua \
gcc
# add user
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
# install as appuser
USER appuser
# setup workdir
WORKDIR /home/appuser
# setup path
ENV PATH=/home/appuser/.TinyTeX/bin/x86_64-linuxmusl/:$PATH
# download and install tinytex
RUN wget -qO- "https://yihui.name/gh/tinytex/tools/install-unx.sh" | sh
# add tlmgr to path
RUN /home/appuser/.TinyTeX/bin/*/tlmgr path add
# verify latex version
RUN latex --version
# verify tlmgr version
RUN tlmgr --version
# install texlive packages
RUN tlmgr install \
preview \
standalone \
dvisvgm
# verify
RUN dvisvgm --version
# setup test
RUN mkdir /tmp/test
# test workdir
WORKDIR /tmp/test
# copy test latex standalone equation
COPY ./test.tex .
# temp assign root to clean up tlmgr only dependencies
USER root
# remove dependencies
RUN apk del wget xz tar
# reset user
USER appuser
# run latex - ignore latex errors
RUN latex -interaction=nonstopmode ./test.tex || true
# run dvisvgm with no-fonts
RUN dvisvgm --no-fonts ./test.dvi
# verify no-font svg was generated
RUN test -f test.svg
# remove no-font svg
RUN rm test.svg
# run dvisvgm with ttf font
RUN dvisvgm --font-format=ttf ./test.dvi
# verify ttf font svg was generated
RUN test -f test.svg
# clean up tests
RUN rm -R /tmp/*
# reset workdir
WORKDIR /home/appuser