-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
139 lines (128 loc) · 4.23 KB
/
Dockerfile
File metadata and controls
139 lines (128 loc) · 4.23 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
FROM debian:stable-slim
LABEL maintainer="Ronald Steffen, FU Berlin <r.steffen@fu-berlin.de>"
ENV PANDOC_VERSION=3.9
ENV SAXON_VERSION=HE12-9
ENV LUA_VERSION=5.4
ENV LUAROCKS_VERSION=3.13.0
ENV PATH="/root/.venv/bin:${PATH}"
# Basic packages
ENV SYS_PACKAGES \
apt-utils \
wget \
zip \
nano \
curl \
unzip \
sudo \
bash-completion
# development packages
ENV DEV_PACKAGES \
# for pandoc custom writer
build-essential \
php \
php-zip \
php-xml \
# for pandoc pdf conversion
librsvg2-bin
ENV DEV_PACKAGES_2 \
# for weasyprint
python3 \
pip \
# for Saxon-HE
default-jre
ENV DEV_PACKAGES_3 \
# for pagedjs, Mathjax
nodejs \
npm
# tools
ENV TOOLS_PACKAGES \
# for PDF conversion with Pandoc
texlive \
# for xml processing/validation
libxml2-utils \
xmlstarlet
ENV TOOLS_PACKAGES_2 \
# for pandoc custom writer
liblua${LUA_VERSION}-dev \
lua5.4 \
libreadline-dev \
pipx \
# for pagedjs/chromium/pupeteer
libxkbcommon-x11-0
# install packages; packages are installed in separate runs due to frequent timeout errors with the Debian server
RUN set -xe && apt-get update \
&& cd home \
&& apt-get install -y $SYS_PACKAGES
RUN set -xe && apt-get update \
&& cd home \
&& apt-get install -y $DEV_PACKAGES
RUN set -xe && apt-get update \
&& cd home \
&& apt-get install -y $DEV_PACKAGES_2
RUN set -xe && apt-get update \
&& cd home \
&& apt-get install -y $TOOLS_PACKAGES
RUN set -xe && apt-get update \
&& cd home \
&& apt-get install -y $TOOLS_PACKAGES_2
# && pipx install panflute \
# && pipx ensurepath
RUN set -xe && apt-get update \
&& cd home \
&& apt-get install -y $DEV_PACKAGES_3
# install required tools not available through the Debian repository
RUN set -xe && cd root \
&& git clone https://github.com/ronste/sspworkflow.git \
# && mkdir sspworkflow \
&& mkdir sspworkflow/lib \
&& mkdir sspworkflow/work \
&& mkdir sspworkflow/store \
&& mkdir sspworkflow/work/media \
&& mkdir sspworkflow/work/metadata\
&& cd sspworkflow/lib \
# create python .venv
&& python3 -m venv /root/.venv \
&& . /root/.venv/bin/activate \
&& pip install --upgrade pip \
&& pip install docx weasyprint \
## docx2jats
&& git clone https://github.com/Vitaliy-1/docxToJats.git \
# Pandoc
&& arch=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) \
&& wget https://github.com/jgm/pandoc/releases/download/${PANDOC_VERSION}/pandoc-${PANDOC_VERSION}-linux-${arch}.tar.gz \
&& tar xvzf pandoc-${PANDOC_VERSION}-linux-${arch}.tar.gz --strip-components 1 -C /usr/local/ \
&& rm pandoc-${PANDOC_VERSION}-linux-${arch}.tar.gz \
# Saxon-HE
&& wget https://github.com/Saxonica/Saxon-HE/releases/download/Saxon${SAXON_VERSION}/Saxon${SAXON_VERSION}J.zip \
&& unzip -d Saxon${SAXON_VERSION}J Saxon${SAXON_VERSION}J.zip \
&& rm Saxon${SAXON_VERSION}J.zip \
# Setup npm and install global packages
&& npm install -g npm@latest \
&& npm install -g \
html-validate \
just-install \
# puppeteer \ # used by pagedjs
# pagedjs-cli@latest # still outdated -> find alternative
# just Bash completion
&& mkdir -p /etc/bash_completion.d \
&& just --completions bash > /etc/bash_completion.d/just \
# Setup npm and install local packages from package.json
&& npm ci --omit=dev --omit=optional \
# for pandoc custom writer
# Install luarocks and dependencies
&& wget https://luarocks.org/releases/luarocks-${LUAROCKS_VERSION}.tar.gz \
&& tar zxpf luarocks-${LUAROCKS_VERSION}.tar.gz \
&& cd luarocks-${LUAROCKS_VERSION} \
&& ./configure && make && sudo make install \
&& luarocks install xml2lua \
&& eval "$(luarocks path)" \
&& cd .. \
&& rm luarocks-${LUAROCKS_VERSION}.tar.gz \
# Setup runConversionChain command
&& echo '#!/usr/bin/env bash' > /bin/runConversionChain \
&& echo "cd /root/sspworkflow/work" >> /bin/runConversionChain \
&& echo 'just "$@"' >> /bin/runConversionChain \
&& chmod u+x /bin/runConversionChain \
&& echo "alias rcc='runConversionChain'" >> /etc/bash.bashrc \
&& runConversionChain reset-example
WORKDIR /root/sspworkflow