forked from tiredofit/docker-collabora-online
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
269 lines (258 loc) · 10.2 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
FROM docker.io/tiredofit/debian:bullseye as builder
LABEL maintainer="Dave Conroy (dave at tiredofit dot ca)"
### Buildtime arguments
ARG COLLABORA_ONLINE_VERSION
ARG COLLABORA_ONLINE_REPO_URL
ARG LIBREOFFICE_VERSION
ARG LIBREOFFICE_REPO_URL
ARG MAX_CONNECTIONS
ARG MAX_DOCUMENTS
ARG APP_NAME
### Environment Variables
ENV COLLABORA_ONLINE_VERSION=${COLLABORA_ONLINE_VERSION:-"cp-22.05.8-3"} \
COLLABORA_ONLINE_REPO_URL=${COLLABORA_ONLINE_REPO_URL:-"https://github.com/CollaboraOnline/online"} \
#
LIBREOFFICE_VERSION=${LIBREOFFICE_VERSION:-"cp-22.05.8-3"} \
LIBREOFFICE_REPO_URL=${LIBREOFFICE_REPO_URL:-"https://github.com/LibreOffice/core"} \
#
APP_NAME=${APP_NAME:-"Document Editor"} \
#
POCO_VERSION=${POCO_VERSION:-"poco-1.12.4-release.tar.gz"} \
POCO_URL=${POCO_URL:-"https://github.com/pocoproject/poco/archive/"} \
#
MAX_CONNECTIONS=${MAX_CONNECTIONS:-"100000"} \
## Uses Approximately 20mb per document open
MAX_DOCUMENTS=${MAX_DOCUMENTS:-"100000"}
COPY build-assets /build-assets
RUN source /assets/functions/00-container && \
set -x && \
apt-get update && \
apt-get -o Dpkg::Options::="--force-confold" upgrade -y && \
echo "deb-src http://deb.debian.org/debian $(cat /etc/os-release |grep "VERSION=" | awk 'NR>1{print $1}' RS='(' FS=')') main" >> /etc/apt/sources.list && \
echo "deb http://deb.debian.org/debian $(cat /etc/os-release |grep "VERSION=" | awk 'NR>1{print $1}' RS='(' FS=')') contrib" >> /etc/apt/sources.list && \
curl -sL https://deb.nodesource.com/setup_14.x | bash - && \
\
### Setup Distribution
echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections && \
\
mkdir -p /home/cool && \
useradd cool -G sudo && \
chown cool:cool /home/cool -R && \
\
BUILD_DEPS=' \
adduser \
automake \
build-essential \
cpio \
default-jre \
devscripts \
fontconfig \
g++ \
git \
inotify-tools \
libcap-dev \
libcap2-bin \
libcppunit-dev \
libghc-zlib-dev \
libkrb5-dev \
libpam-dev \
libpam0g-dev \
libpng16-16 \
libssl-dev \
libtool \
libubsan1 \
libzstd-dev \
locales-all \
m4 \
nasm \
nodejs \
openssl \
pkg-config \
procps \
python3-lxml \
python3-polib \
sudo \
translate-toolkit \
ttf-mscorefonts-installer \
wget \
' && \
## Add Build Dependencies
apt-get install -y \
${BUILD_DEPS} \
&& \
\
apt-get build-dep -y \
libreoffice \
&& \
\
### Build Poco
mkdir -p /usr/src/poco && \
curl -sSL ${POCO_URL}${POCO_VERSION} | tar xvfz - --strip 1 -C /usr/src/poco && \
cd /usr/src/poco && \
./configure \
--static \
--no-tests \
--no-samples \
--no-sharedlibs \
--cflags="-fPIC" \
--omit=Zip,Data,Data/SQLite,Data/ODBC,Data/MySQL,MongoDB,PDF,CppParser,PageCompiler,Redis,Encodings \
--prefix=/opt/poco \
&& \
make -j$(nproc) && \
make install && \
\
### Build Fetch LibreOffice - This will take a while..
clone_git_repo ${LIBREOFFICE_REPO_URL} ${LIBREOFFICE_VERSION} ${GIT_REPO_SRC_CORE} && \
if [ -d "/build-assets/core/src" ] ; then cp -R /build-assets/core/src/* ${GIT_REPO_SRC_CORE} ; fi; \
if [ -d "/build-assets/core/scripts" ] ; then for script in /build-assets/core/scripts/*.sh; do echo "** Applying $script"; bash $script; done && \ ; fi ; \
sed -i "s|--enable-symbols|--disable-symbols|g" ${GIT_REPO_SRC_CORE}/distro-configs/CPLinux-LOKit.conf && \
\
echo "--prefix=/opt/libreoffice" >> ${GIT_REPO_SRC_CORE}/distro-configs/CPLinux-LOKit.conf && \
./autogen.sh \
--with-distro="CPLinux-LOKit" \
--disable-epm \
--without-package-format && \
chown -R cool ${GIT_REPO_SRC_CORE} && \
sudo -u cool make fetch && \
sudo -u cool make -j$(nproc) build-nocheck && \
mkdir -p /opt/libreoffice && \
chown -R cool /opt/libreoffice && \
cp -R ${GIT_REPO_SRC_CORE}/instdir/* /opt/libreoffice/ && \
\
### Build LibreOffice Online (Not as long as above)
clone_git_repo ${COLLABORA_ONLINE_REPO_URL} ${COLLABORA_ONLINE_VERSION} ${GIT_REPO_SRC_ONLINE} && \
if [ -d "/build-assets/online/src" ] ; then cp -R /build-assets/online/src/* ${GIT_REPO_SRC_ONLINE} ; fi; \
if [ -d "/build-assets/online/scripts" ] ; then for script in /build-assets/online/scripts/*.sh; do echo "** Applying $script"; bash $script; done && \ ; fi ; \
sed -i "s|Collabora Online Development Edition|${APP_NAME}|g" ${GIT_REPO_SRC_ONLINE}/configure.ac && \
sed -i "s|Collabora Online Development Edition|${APP_NAME}|g" ${GIT_REPO_SRC_ONLINE}/browser/admin/admin.strings.js && \
sed -i "s|Collabora Online Development Edition|${APP_NAME}|g" ${GIT_REPO_SRC_ONLINE}/browser/src/control/Toolbar.js && \
sed -i "s|Collabora Online Development Edition|${APP_NAME}|g" ${GIT_REPO_SRC_ONLINE}/browser/src/core/Socket.js && \
sed -i "s|Collabora Online Development Edition|${APP_NAME}|g" ${GIT_REPO_SRC_ONLINE}/browser/src/layer/marker/ProgressOverlay.js && \
sed -i "s|Collabora Online Development Edition|${APP_NAME}|g" ${GIT_REPO_SRC_ONLINE}/browser/src/map/Clipboard.js && \
sed -i "s|Collabora Online Development Edition|${APP_NAME}|g" ${GIT_REPO_SRC_ONLINE}/browser/welcome/*.html && \
./autogen.sh && \
./configure --enable-silent-rules \
--with-lokit-path="${GIT_REPO_SRC_CORE}/include" \
--with-lo-path=/opt/libreoffice \
--with-max-connections=${MAX_CONNECTIONS} \
--with-max-documents=${MAX_DOCUMENTS} \
--with-logfile=/var/log/cool/cool.log \
--prefix=/opt/cool \
--sysconfdir=/etc \
--localstatedir=/var \
--with-poco-includes=/opt/poco/include \
--with-poco-libs=/opt/poco/lib \
--with-app-name="${APP_NAME}" \
--with-vendor="tiredofit@github" \
${COOL_CONFIGURE_ARGS} \
&& \
make -j$(nproc) && \
mkdir -p /opt/cool && \
chown -R cool /opt/cool && \
cp -R coolwsd.xml /opt/cool/ && \
cp -R coolkitconfig.xcu /opt/cool && \
make install && \
\
### Cleanup
cd / && \
apt-get autoremove -y && \
apt-get clean && \
rm -rf /usr/src/* && \
rm -rf /usr/share/doc && \
rm -rf /usr/share/man && \
rm -rf /usr/share/locale && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /var/log/*
FROM docker.io/tiredofit/debian:bullseye
LABEL maintainer="Dave Conroy (dave at tiredofit dot ca)"
### Set Defaults
ENV ADMIN_USER=admin \
ADMIN_PASS=collaboraonline \
CONTAINER_ENABLE_MESSAGING=FALSE \
IMAGE_NAME="tiredofit/collabora-online" \
IMAGE_REPO_URL="https://github.com/tiredofit/docker-collabora-online/"
### Grab Compiled Assets from builder image
COPY --from=builder /opt/ /opt/
COPY CHANGELOG.md /assets/.changelogs/tiredofit_docker-collabora-online.md
COPY build-assets /build-assets
### Install Dependencies
RUN set -x && \
adduser --quiet --system --group --home /opt/cool cool && \
\
### Add Repositories
echo "deb http://deb.debian.org/debian $(cat /etc/os-release |grep "VERSION=" | awk 'NR>1{print $1}' RS='(' FS=')') contrib" >> /etc/apt/sources.list && \
echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections && \
apt-get update && \
apt-get -o Dpkg::Options::="--force-confold" upgrade -y && \
apt-get install -y\
apt-transport-https \
cpio \
findutils \
fontconfig \
hunspell \
hunspell-en-ca \
hunspell-en-gb \
hunspell-en-us \
inotify-tools \
libcap2-bin \
libcups2 \
libfontconfig1 \
libfreetype6 \
libgl1-mesa-glx \
libpam0g \
libpng16-16 \
libsm6 \
libubsan1 \
libxcb-render0 \
libxcb-shm0 \
libxinerama1 \
libxrender1 \
locales \
locales-all \
openssl \
openssh-client \
procps \
python3-requests \
python3-websocket \
ttf-mscorefonts-installer \
&& \
\
### Setup Directories and Permissions
mkdir -p /etc/coolwsd && \
mv /opt/cool/coolwsd.xml /etc/coolwsd/ && \
mv /opt/cool/coolkitconfig.xcu /etc/coolwsd/ && \
chown -R cool /etc/coolwsd && \
mkdir -p /opt/cool/child-roots && \
chown -R cool /opt/* && \
mkdir -p /var/cache/coolwsd && \
chown -R cool /var/cache/coolwsd && \
setcap cap_fowner,cap_chown,cap_mknod,cap_sys_chroot=ep /opt/cool/bin/coolforkit && \
setcap cap_sys_admin=ep /opt/cool/bin/coolmount && \
mkdir -p /usr/share/hunspell && \
mkdir -p /usr/share/hyphen && \
mkdir -p /usr/share/mythes && \
mkdir -p /var/cache/coolwsd && \
chown -R cool /var/cache/coolwsd && \
mkdir -p /var/log/cool && \
touch /var/log/cool/coolwsd.log && \
chown -R cool /var/log/cool && \
\
### Setup LibreOffice Online Jails
sudo -u cool /opt/cool/bin/coolwsd-systemplate-setup /opt/cool/systemplate /opt/libreoffice && \
\
if [ -d "/build-assets/container/src" ] ; then cp -R /build-assets/container/src/* / ; fi; \
if [ -d "/build-assets/container/scripts" ] ; then for script in /build-assets/container/scripts/*.sh; do echo "** Applying $script"; bash $script; done && \ ; fi ; \
apt-get autoremove -y && \
apt-get clean && \
\
rm -rf /usr/src/* && \
rm -rf /usr/share/doc && \
rm -rf /usr/share/man && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /var/log/* && \
rm -rf /build-assets && \
rm -rf /tmp/*
### Networking Configuration
EXPOSE 9980
### Assets
COPY install /