-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
303 lines (286 loc) · 12.9 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
ARG ASCIIDOCTOR_BASE_TAG=${CIRCLE_TAG:-latest}
ARG alpine_version=3.18
ARG golang_version=1.20
# Build ASCIIToSVG - @see: https://github.com/asciitosvg/asciitosvg
FROM golang:${golang_version}-alpine${alpine_version} as go-builder
# No branch/tag/version available; pin to the last known commit for now
# https://github.com/asciitosvg/asciitosvg/commit/ca82a5ce41e2190a05e07af6e8b3ea4e3256a283
RUN apk add --no-cache git \
&& go install github.com/asciitosvg/asciitosvg/cmd/a2s@ca82a5ce41e2190a05e07af6e8b3ea4e3256a283
# =========================================
# Build dpic- @see: https://gitlab.com/aplevich/dpic
# Build pikchr - @see: https://github.com/drhsqlite/pikchr
FROM alpine:${alpine_version} as make-builder
RUN apk add --no-cache \
build-base \
make \
bison \
git
RUN git clone --depth 1 https://gitlab.com/aplevich/dpic.git /dpic \
&& cd /dpic \
&& make PREFIX=local installdpic
RUN git clone --depth 1 -b "master" https://github.com/drhsqlite/pikchr.git /pikchr \
&& cd /pikchr \
&& make pikchr
# =========================================
FROM uwebarthel/asciidoctor-base:${ASCIIDOCTOR_BASE_TAG} as asciidoctor-builder
ENV TMPDIR "/tmp"
# Install ASCIIToSVG
COPY --from=go-builder /go/bin/a2s /usr/local/bin/
# Install dpic
COPY --from=make-builder /usr/local/bin/dpic /usr/local/bin/
# Install pikchr
COPY --from=make-builder /pikchr/pikchr /usr/local/bin/
# @see: https://gitlab.alpinelinux.org/alpine/infra/infra/-/issues/8087
# @see: https://github.com/alpinelinux/docker-alpine/issues/98
RUN sed -i 's/https/http/' /etc/apk/repositories
# Adds edge/testing package repo for svgbob, pdf2svg
RUN echo "@testing http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
RUN cat /etc/alpine-release \
&& apk fix && apk update
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# 'Native' apk packages
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Install gnuplot - @see: http://gnuplot.info/
# Install imagemagick for meme - @see: https://asciidoctor.org/docs/asciidoctor-diagram/#meme
# Install svgbob - @see: https://github.com/ivanceras/svgbob
# Install tikz (texlive, pdf2svg) - @see:https://github.com/pgf-tikz/pgf
RUN apk --no-cache add \
gnuplot \
imagemagick \
svgbob@testing \
texlive \
texmf-dist-latexextra \
pdf2svg@testing \
git
ARG umlet_version="15.1"
# The umlet zip contains a camelcase directory :-|
ENV UMLET_HOME="${UMLET_HOME:-/usr/local/Umlet}"
# The umlet extension try to find 'umlet' in PATH and need the 'umlet.jar' in same directory :-|
ENV PATH "${UMLET_HOME}:${PATH}"
ENV UMLET_JAVA_OPTS="-Djava.awt.headless=true"
# Umlet edownload URL uses inconsistent version formats :-|
RUN curl -S -s -o ${TMPDIR}/umlet.zip https://www.umlet.com/download/umlet_${umlet_version//./_}/umlet-standalone-${umlet_version}.zip \
&& unzip -d /usr/local ${TMPDIR}/umlet.zip "*.jar" "*.sh"\
&& rm -f ${TMPDIR}/umlet.zip \
&& ln -snf "${UMLET_HOME}/umlet.sh" "${UMLET_HOME}/umlet"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# 'Node.js' packages
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Install mermaid-cli - @see: https://github.com/mermaid-js/mermaid-cli
ARG mermaid_version="10.0.2"
# Install mscgenjs-cli - @see: https://github.com/mscgenjs/mscgenjs-cli
ARG mscgen_version="6.0.0"
# Install bpmn-js-cmd - @see: https://github.com/gtudan/bpmn-js-cmd
ARG bpmn_version="0.4.0"
# Install bytefield-svg - @see: https://github.com/Deep-Symmetry/bytefield-svg
ARG bytefield_version="1.8.0"
# Install nomnoml - @see: https://github.com/skanaar/nomnoml
ARG nomnoml_version="1.5.3"
# Install state-machine-cat (smcat) - @see: https://github.com/sverweij/state-machine-cat/
ARG smc_version="10.1.10"
# Install vega - @see: https://github.com/vega/vega
ARG canvas_version="2.11.0"
ARG vega_version="5.24.0"
# Install vega-lite - @see: https://github.com/vega/vega-lite
ARG vega_lite_version="5.6.0"
# Install WaveDrom - @see: https://github.com/wavedrom/wavedrom, https://github.com/wavedrom/cli
ARG wavedrom_version="3.2.0"
ARG wavedrom_cli_version="3.1.1"
# Install inliner - @see: https://github.com/barthel/inliner
ARG inliner_version="1.14.0"
# @see: https://github.com/puppeteer/puppeteer/issues/379#issuecomment-437688436
# @see: https://github.com/puppeteer/puppeteer/blob/v2.1.1/docs/api.md#environment-variables
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD "true"
ENV puppeteer_skip_download "true"
# Puppeteer version and Chromium version are related
ARG puppeteer_version="19.7.5"
ENV PUPPETEER_CHROMIUM_REVISION "1145735"
ENV puppeteer_chromium_revision "1145735"
# ENV CHROMIUM_PATH "$(which chromium-browser)" # will be exported by entrypoint.sh
# @see: https://github.com/nodejs/docker-node/issues/1794
# @see: https://github.com/nodejs/docker-node/issues/1798
# @see: https://superuser.com/a/1058665
# @see: https://github.com/puppeteer/puppeteer/blob/master/docs/troubleshooting.md#running-on-alpine
# !!!
# Split into several `yarn add` and `yarn install` steps because of
# 'There appears to be trouble with your network connection. Retrying…' issue in Circle CI
# !!!
# Most of the devel dependencies are required by canvas
RUN apk --no-cache add \
nodejs \
'chromium~=114.0.5735' \
nss \
freetype \
harfbuzz \
ttf-freefont \
cairo \
pango \
&& apk --no-cache --virtual .nodejsyarndepends add \
build-base \
cairo-dev \
pango-dev \
libjpeg-turbo-dev \
giflib-dev \
yarn \
npm \
&& yarn config set network-timeout 3600000 --global\
&& yarn config set non-interactive --global \
&& yarn config set production --global \
&& yarn config set pnp --global \
&& yarn config set silent --global \
&& yarn config set no-lockfile --global \
&& yarn config set no-progress --global \
&& echo "Install puppeteer@${puppeteer_version}" \
&& yarn global add \
"puppeteer-core@${puppeteer_version}" \
"puppeteer@${puppeteer_version}" \
&& yarn install --no-lockfile \
&& echo "Install mermaid-cli@${mermaid_version}" \
&& yarn global add \
"@mermaid-js/mermaid-cli@${mermaid_version}" \
&& yarn install --no-lockfile \
&& echo -e "{\n\t\"product\": \"chrome\",\n\t\"headless\": true,\n\t\"executablePath\": \"$(which chromium-browser)\",\n\t\"ignoreHTTPSErrors\": true,\n\t\"args\": [\n\t\t\"--no-sandbox\",\n\t\t\"--allow-insecure-localhost\",\n\t\t\"--timeout 30000\"\n\t]\n}" > /usr/local/mmdc_puppeteer-config.json \
&& echo "Install mscgen-cli@${mscgen_version}" \
&& yarn global add \
"mscgenjs-cli@${mscgen_version}" \
&& yarn install --no-lockfile \
&& echo -e "{\n\t\"devtools\": false,\n\t\"headless\": true,\n\t\"executablePath\": \"$(which chromium-browser)\",\n\t\"timeout\": 30000,\n\t\"args\": [\n\t\t\"--no-sandbox\",\n\t\t\"--allow-insecure-localhost\"\n\t]\n}" > /usr/local/mscgen_js_puppeteer-config.json \
&& echo "Install bpmn-js-cmd@${bpmn_version}" \
&& yarn global add \
"bpmn-js-cmd@${bpmn_version}" \
&& yarn install --no-lockfile \
&& echo "Install bytefield-svg@${bytefield_version}" \
&& yarn global add \
"bytefield-svg@${bytefield_version}" \
&& yarn install --no-lockfile \
&& echo "Install nomnoml@${nomnoml_version}" \
&& yarn global add \
"nomnoml@${nomnoml_version}" \
&& yarn install --no-lockfile \
&& echo "Install state-machine-cat@${smc_version}" \
&& yarn global add \
"state-machine-cat@${smc_version}" \
&& yarn install --no-lockfile \
&& echo "Install canvas@${canvas_version}" \
&& npm install --global --build-from-source \
"canvas@${canvas_version}" \
&& echo "Install vage/vega-cli@${vega_version}" \
&& yarn global add \
"vega@${vega_version}" \
"vega-cli@${vega_version}" \
&& yarn install --no-lockfile \
&& echo "Install vega-lite@${vega_lite_version}" \
&& yarn global add \
"vega-lite@${vega_lite_version}" \
&& yarn install --no-lockfile \
&& echo "Install wavedrom@${wavedrom_version}, wavedrom-cli@${wavedrom_cli_version}" \
&& yarn global add \
"wavedrom@${wavedrom_version}" \
"wavedrom-cli@${wavedrom_cli_version}" \
&& yarn install --no-lockfile \
&& echo "Install inliner@${inliner_version}" \
&& yarn global add \
"inliner@https://github.com/barthel/inliner" \
&& yarn install --no-lockfile \
&& echo "Adapt executable" \
&& mv /usr/local/bin/mmdc /usr/local/bin/mmdc.node \
&& rm -f /usr/local/bin/mmdc \
&& echo -e "#!/bin/sh\n/usr/local/bin/mmdc.node --puppeteerConfigFile /usr/local/mmdc_puppeteer-config.json \${@}" > /usr/local/bin/mmdc \
&& chmod +x /usr/local/bin/mmdc \
&& mv /usr/local/bin/mscgen_js /usr/local/bin/mscgen_js.node \
&& rm -f /usr/local/bin/mscgen_js \
&& echo -e "#!/bin/sh\n/usr/local/bin/mscgen_js.node --puppeteer-options /usr/local/mscgen_js_puppeteer-config.json \${@}" > /usr/local/bin/mscgen_js \
&& ln -snf /usr/local/bin/mscgen_js /usr/local/bin/mscgen \
&& chmod +x /usr/local/bin/mscgen* \
&& rm -rf ${TMPDIR}/yarn* \
&& apk del .nodejsyarndepends
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# 'Ruby' packages
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Install barby
RUN apk add --no-cache --virtual .rubymakedepends \
build-base \
libxml2-dev \
ruby-dev \
&& gem install --no-document \
barby rqrcode chunky_png \
&& apk del -r --no-cache .rubymakedepends
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# 'Python' packages
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Install diagrams - @see: https://diagrams.mingrammer.com/docs/getting-started/installation
# Install symbolator - @see: https://github.com/hdl/symbolator (fork because of incompatible setup 2to3)
# Install htlmark - @see: https://github.com/BitLooter/htmlark
ARG htmlark_version="1.0.0"
ARG requests_version="2.28.2"
ARG beautifulsoup4_version="4.12.0"
ARG lxml_version="4.9.2"
ARG html5lib_version="1.1"
RUN apk add --no-cache \
python3 \
py3-pillow \
py3-setuptools \
py3-typed-ast \
py3-gobject3 \
py3-cairo \
py3-cairosvg \
libxml2 \
libxslt \
&& apk add --no-cache --virtual .pythonmakedepends \
build-base \
libxml2-dev \
libxslt-dev \
freetype-dev \
python3-dev \
py3-gobject3-dev \
py3-cairo-dev \
py3-pip \
&& pip3 install --no-cache-dir \
https://github.com/hdl/pyhdlparser/tarball/master \
https://github.com/hdl/symbolator/tarball/master \
diagrams \
"beautifulsoup4==${beautifulsoup4_version}" \
"requests==${requests_version}" \
"lxml==${lxml_version}" \
"html5lib==${html5lib_version}" \
"htmlark==${htmlark_version}" \
&& apk del -r --no-cache .pythonmakedepends
# Install syntrax - @see: https://github.com/kevinpt/syntrax.git (requires manually fix incompatible setup 2to3)
# The setup command 'use_2to3' is not supported anymore by setuptools - @see: https://github.com/pypa/setuptools/issues/2775
# The 'collections' import has changed with python 3.10 and must be adapted - @see: https://github.com/python/cpython/issues/89934
RUN apk add --no-cache \
git \
python3 \
py3-pillow \
py3-setuptools \
py3-typed-ast \
py3-gobject3 \
py3-cairo \
py3-cairosvg \
&& apk add --no-cache --virtual .pythonsyntraxdepends \
build-base \
freetype-dev \
python3-dev \
py3-gobject3-dev \
py3-cairo-dev \
py3-pip \
&& git clone --depth 1 https://github.com/kevinpt/syntrax.git ${TMPDIR}/syntrax \
&& sed -i 's|use_2to3 = True,||' ${TMPDIR}/syntrax/setup.py \
&& 2to3 --no-diffs -p -e -W -n -w ${TMPDIR}/syntrax \
&& sed -i 's|import collections|import collections.abc|' ${TMPDIR}/syntrax/syntrax.py \
&& sed -i 's|collections.Sequence|collections.abc.Sequence|g' ${TMPDIR}/syntrax/syntrax.py \
&& pip3 install --no-cache-dir \
${TMPDIR}/syntrax \
&& rm -rf ${TMPDIR}/syntrax \
&& apk del -r --no-cache .pythonsyntraxdepends
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Asciidoc extensions
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Install asciidoctor extensions
# @see: https://docs.asciidoctor.org/asciidoctor/latest/extensions/
# @see: https://github.com/asciidoctor/asciidoctor-extensions-lab
# !!! Please do not use this code in production. !!!
RUN git clone --depth 1 https://github.com/asciidoctor/asciidoctor-extensions-lab.git /usr/local/asciidoctor-extensions
COPY ./entrypoint.sh /entrypoint.sh
ENTRYPOINT [ "/bin/sh", "/entrypoint.sh" ]