-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
179 lines (133 loc) · 5.13 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
FROM node:12.13.0-alpine as node_builder
ARG mermaid_version=8.8.0
ENV NODE_ENV production
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
ENV NPM_CONFIG_LOGLEVEL=error
RUN apk add --no-cache python make g++
WORKDIR /decktape
COPY scripts/decktape/package.json scripts/decktape/npm-shrinkwrap.json ./
COPY scripts/decktape/libs libs/
COPY scripts/decktape/plugins plugins/
COPY scripts/decktape/decktape.js ./
# Force HummusJS build from source
# See https://github.com/galkahana/HummusJS/issues/230
RUN npm install --build-from-source=hummus && \
rm -rf node_modules/hummus/src && \
rm -rf node_modules/hummus/build
WORKDIR /mermaid
RUN npm install @mermaid-js/mermaid-cli@${mermaid_version}
ADD scripts/mermaid/puppeteer.json ./
WORKDIR /vega
RUN apk --no-cache --virtual .canvas-build-deps add \
build-base \
cairo-dev \
jpeg-dev \
pango-dev \
giflib-dev \
pixman-dev \
pangomm-dev \
libjpeg-turbo-dev \
freetype-dev \
&& apk --no-cache add \
pixman \
cairo \
pango \
giflib \
&& npm config set user 0 \
&& npm config set unsafe-perm true \
&& npm install --build-from-source vega-cli vega vega-lite vega-embed
FROM alpine as pandoc_builder
ARG pandoc_version=2.10.1
ENV PANDOC_VERSION=${pandoc_version}
RUN mkdir /pandoc && wget -q https://github.com/jgm/pandoc/releases/download/${PANDOC_VERSION}/pandoc-${PANDOC_VERSION}-linux-amd64.tar.gz -P /tmp/ \
&& tar xzf /tmp/pandoc-${PANDOC_VERSION}-linux-amd64.tar.gz --strip-components 1 -C /pandoc/ \
&& rm -f /tmp/pandoc-${PANDOC_VERSION}-linux-amd64.tar.gz
FROM alpine as grammalecte_builder
ARG grammalecte_version=1.7.0
ENV GRAMMALECTE_VERSION=${grammalecte_version}
RUN mkdir /grammalecte && wget -q https://grammalecte.net/grammalecte/zip/Grammalecte-fr-v${GRAMMALECTE_VERSION}.zip -P /grammalecte/ \
&& unzip -qq /grammalecte/Grammalecte-fr-v${GRAMMALECTE_VERSION}.zip -d /grammalecte/ \
&& rm -f /grammalecte/Grammalecte-fr-v${GRAMMALECTE_VERSION}.zip
FROM alpine as revealjs_builder
# carefull to asciidoc-revealjs version
ARG revealjs_version=3.9.2
ENV REVEALJS_VERSION=${revealjs_version}
RUN mkdir /revealjs && wget -q https://transfer.q2r.net/MCaDZ/${REVEALJS_VERSION}.tar.gz -P /tmp/ \
&& tar xzf /tmp/${REVEALJS_VERSION}.tar.gz --strip-components 1 -C /revealjs/
# ------ Final dockerfile ------
FROM asciidoctor/docker-asciidoctor
# Write UID/GID overwrite
ENV PID=1000
ENV GID=1000
LABEL MAINTAINERS="[email protected]"
# qpdf installation
RUN apk add --no-cache qpdf
# Chromium installation
RUN apk add --no-cache chromium --repository=http://dl-cdn.alpinelinux.org/alpine/v3.10/main
# Revealjs installation
COPY --from=revealjs_builder /revealjs /reveal.js
# upgrade version due to multicolumn layout
RUN apk add --no-cache --virtual .rubymakedepends \
build-base \
libxml2-dev \
ruby-dev \
&& gem install --no-document \
"asciidoctor-revealjs:4.0.1" \
&& apk del -r --no-cache .rubymakedepends
# Node.js installation
WORKDIR /
COPY --from=node_builder /usr/local/bin/node /usr/local/bin/
# DeckTape installation
ENV TERM xterm-color
RUN echo @edge http://nl.alpinelinux.org/alpine/edge/community >> /etc/apk/repositories && \
echo @edge http://nl.alpinelinux.org/alpine/edge/main >> /etc/apk/repositories && \
echo @edge http://nl.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories && \
apk add --no-cache \
ca-certificates \
libstdc++@edge \
font-noto-emoji@edge \
freetype@edge \
harfbuzz@edge \
nss@edge \
ttf-freefont@edge \
wqy-zenhei@edge && \
mv /etc/fonts/conf.d/44-wqy-zenhei.conf /etc/fonts/conf.d/74-wqy-zenhei.conf
COPY --from=node_builder /decktape /decktape
ADD scripts/decktape/decktape /usr/local/bin/decktape
# Mermaid installation
COPY --from=node_builder /mermaid /mermaid
ADD scripts/mermaid/mmdc /usr/local/bin/mmdc
# Vega installation
COPY --from=node_builder /vega /vega
ENV PATH="/vega/node_modules/vega-cli/bin:/vega/node_modules/vega-lite/bin:${PATH}"
# gnuplot installation
# Pandoc installation
COPY --from=pandoc_builder /pandoc /pandoc
ENV PATH="/pandoc/bin:${PATH}"
# Grammalecte installation
COPY --from=grammalecte_builder /grammalecte /grammalecte
# aspell && gnuplot installation
RUN apk add --no-cache \
aspell \
aspell-en \
aspell-fr \
gnuplot
RUN rm -rf /var/cache/apk/*
# yq installation
RUN wget $(curl -s https://api.github.com/repos/mikefarah/yq/releases/latest | grep browser_download_url | grep linux_amd64 | cut -d '"' -f 4) -O /usr/bin/yq && chmod +x /usr/bin/yq
# ----- DocsAsCode -----
# ADD scripts/docsascode/*.tex /usr/local/bin/templates/
ADD scripts/docsascode/*.lua /usr/local/bin/templates/
ADD scripts/docsascode/*.sh /usr/local/bin/
# ------ Themes & checks integration --------
ADD fonts/* /tmp/fonts/
RUN mv /tmp/fonts/* $(gem environment gemdir)/gems/asciidoctor-pdf-${ASCIIDOCTOR_PDF_VERSION}/data/fonts/
ADD checks/ /checks/
ADD outputs/ /output/
RUN addgroup -g 1000 node && \
adduser -u 1000 -G node -s /bin/sh -D node && \
chown node:node /documents
WORKDIR /documents
VOLUME /documents
# USER node
ENTRYPOINT ["entrypoint.sh"]