docker-collabora-online/Dockerfile

277 lines
10 KiB
Docker
Raw Normal View History

2021-12-03 04:26:38 +01:00
FROM docker.io/tiredofit/debian:bullseye as builder
2018-03-24 21:07:22 +01:00
LABEL maintainer="Dave Conroy (dave at tiredofit dot ca)"
2021-02-20 03:51:09 +01:00
### Buildtime arguments
2021-05-18 15:52:51 +02:00
ARG COLLABORA_ONLINE_BRANCH
ARG COLLABORA_ONLINE_VERSION
ARG COLLABORA_ONLINE_REPO_URL
2021-02-20 03:51:09 +01:00
ARG LIBREOFFICE_BRANCH
ARG LIBREOFFICE_VERSION
ARG LIBREOFFICE_REPO_URL
ARG MAX_CONNECTIONS
ARG MAX_DOCUMENTS
2021-04-10 01:15:54 +02:00
ARG APP_NAME
2021-02-20 03:51:09 +01:00
### Environment Variables
2021-05-18 15:52:51 +02:00
ENV COLLABORA_ONLINE_BRANCH=${COLLABORA_ONLINE_BRANCH:-"master"} \
2022-02-10 21:22:00 +01:00
COLLABORA_ONLINE_VERSION=${COLLABORA_ONLINE_VERSION:-"cp-21.11.2-0"} \
2021-05-18 15:52:51 +02:00
COLLABORA_ONLINE_REPO_URL=${COLLABORA_ONLINE_REPO_URL:-"https://github.com/CollaboraOnline/online"} \
2021-07-11 18:54:02 +02:00
#
2021-05-18 15:52:51 +02:00
LIBREOFFICE_BRANCH=${LIBREOFFICE_BRANCH:-"master"} \
2022-02-10 21:22:00 +01:00
LIBREOFFICE_VERSION=${LIBREOFFICE_VERSION:-"cp-21.06.16-1"} \
2021-02-20 03:51:09 +01:00
LIBREOFFICE_REPO_URL=${LIBREOFFICE_REPO_URL:-"https://github.com/LibreOffice/core"} \
#
2021-04-10 01:15:54 +02:00
APP_NAME=${APP_NAME:-"Document Editor"} \
#
2021-12-03 04:26:38 +01:00
POCO_VERSION=${POCO_VERSION:-"poco-1.11.1-release.tar.gz"} \
2021-02-20 03:51:09 +01:00
POCO_URL=${POCO_URL:-"https://github.com/pocoproject/poco/archive/"} \
#
2021-04-10 01:15:54 +02:00
MAX_CONNECTIONS=${MAX_CONNECTIONS:-"100000"} \
2018-09-17 14:33:41 +02:00
## Uses Approximately 20mb per document open
2021-04-10 01:15:54 +02:00
MAX_DOCUMENTS=${MAX_DOCUMENTS:-"100000"}
2021-02-20 03:51:09 +01:00
ADD build-assets /build-assets
2018-03-24 21:07:22 +01:00
2018-09-17 14:33:41 +02:00
### Get Updates
2019-02-28 17:02:34 +01:00
RUN set -x && \
### Add Repositories
2019-07-07 15:19:10 +02:00
apt-get update && \
apt-get -o Dpkg::Options::="--force-confold" upgrade -y && \
2021-12-03 04:26:38 +01:00
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 && \
2021-05-27 17:18:16 +02:00
curl -sL https://deb.nodesource.com/setup_14.x | bash - && \
2018-09-17 14:33:41 +02:00
\
2019-02-28 17:02:34 +01:00
### Setup Distribution
echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections && \
2018-09-17 14:33:41 +02:00
\
2021-12-03 04:26:38 +01:00
mkdir -p /home/cool && \
useradd cool -G sudo && \
chown cool:cool /home/cool -R && \
2018-09-17 14:33:41 +02:00
\
2021-02-20 03:51:09 +01:00
BUILD_DEPS=' \
adduser \
automake \
build-essential \
2018-03-24 21:07:22 +01:00
cpio \
2021-02-20 03:51:09 +01:00
default-jre \
devscripts \
fontconfig \
g++ \
2018-03-24 21:07:22 +01:00
git \
2021-02-20 03:51:09 +01:00
inotify-tools \
2018-03-24 21:07:22 +01:00
libcap-dev \
2021-02-20 03:51:09 +01:00
libcap2-bin \
libcppunit-dev \
2018-09-17 14:33:41 +02:00
libghc-zlib-dev \
2021-02-20 03:51:09 +01:00
libkrb5-dev \
libpam-dev \
2018-03-24 21:07:22 +01:00
libpam0g-dev \
2021-02-20 03:51:09 +01:00
libpng16-16 \
libssl-dev \
2018-03-24 21:07:22 +01:00
libtool \
2021-02-20 03:51:09 +01:00
libubsan1 \
locales-all \
m4 \
2019-02-28 17:02:34 +01:00
nasm \
2018-03-24 21:07:22 +01:00
nodejs \
openssl \
2021-02-20 03:51:09 +01:00
pkg-config \
procps \
python3-lxml \
python3-polib \
2018-03-24 21:07:22 +01:00
sudo \
2018-09-17 14:33:41 +02:00
translate-toolkit \
2018-03-24 21:07:22 +01:00
ttf-mscorefonts-installer \
wget \
2021-02-20 03:51:09 +01:00
' && \
## Add Build Dependencies
apt-get install -y \
${BUILD_DEPS} \
2018-03-24 21:07:22 +01:00
&& \
2018-09-17 14:33:41 +02:00
\
2018-03-24 21:07:22 +01:00
apt-get build-dep -y \
libreoffice \
&& \
2018-09-17 14:33:41 +02:00
\
2021-02-20 03:51:09 +01:00
### Build Poco
2019-02-28 17:02:34 +01:00
mkdir -p /usr/src/poco && \
2021-02-20 03:51:09 +01:00
curl -sSL ${POCO_URL}${POCO_VERSION} | tar xvfz - --strip 1 -C /usr/src/poco && \
2019-02-28 17:02:34 +01:00
cd /usr/src/poco && \
./configure \
2021-02-20 03:51:09 +01:00
--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) && \
2019-02-28 17:02:34 +01:00
make install && \
\
2021-02-20 03:51:09 +01:00
### Build Fetch LibreOffice - This will take a while..
git clone -b ${LIBREOFFICE_BRANCH} ${LIBREOFFICE_REPO_URL} /usr/src/libreoffice-core && \
2018-03-24 21:07:22 +01:00
cd /usr/src/libreoffice-core && \
2021-02-20 03:51:09 +01:00
git checkout ${LIBREOFFICE_VERSION} && \
if [ -d "/build-assets/core/src" ] ; then cp -R /build-assets/core/src/* /usr/src/libreoffice-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 ; \
2021-03-24 18:37:19 +01:00
sed -i "s|--enable-symbols|--disable-symbols|g" /usr/src/libreoffice-core/distro-configs/CPLinux-LOKit.conf && \
2021-02-20 03:51:09 +01:00
\
echo "--prefix=/opt/libreoffice" >> /usr/src/libreoffice-core/distro-configs/CPLinux-LOKit.conf && \
./autogen.sh \
--with-distro="CPLinux-LOKit" \
--disable-epm \
--without-package-format && \
2021-12-03 04:26:38 +01:00
chown -R cool /usr/src/libreoffice-core && \
sudo -u cool make fetch && \
sudo -u cool make -j$(nproc) build-nocheck && \
2018-03-24 21:07:22 +01:00
mkdir -p /opt/libreoffice && \
2021-12-03 04:26:38 +01:00
chown -R cool /opt/libreoffice && \
2021-12-03 04:29:43 +01:00
cp -R /usr/src/libreoffice-core/instdir/* /opt/libreoffice/ && \
2018-09-17 14:33:41 +02:00
\
2021-02-20 03:51:09 +01:00
### Build LibreOffice Online (Not as long as above)
2021-12-03 04:26:38 +01:00
git clone -b ${COLLABORA_ONLINE_BRANCH} ${COLLABORA_ONLINE_REPO_URL} /usr/src/collabora-online && \
cd /usr/src/collabora-online && \
2021-05-18 15:52:51 +02:00
git checkout ${COLLABORA_ONLINE_VERSION} && \
2021-12-03 04:26:38 +01:00
if [ -d "/build-assets/online/src" ] ; then cp -R /build-assets/online/src/* /usr/src/collabora-online ; fi; \
2021-02-20 03:51:09 +01:00
if [ -d "/build-assets/online/scripts" ] ; then for script in /build-assets/online/scripts/*.sh; do echo "** Applying $script"; bash $script; done && \ ; fi ; \
2021-12-03 04:26:38 +01:00
sed -i "s|Collabora Online Development Edition|${APP_NAME}|g" /usr/src/collabora-online/configure.ac && \
sed -i "s|Collabora Online Development Edition|${APP_NAME}|g" /usr/src/collabora-online/browser/admin/admin.strings.js && \
sed -i "s|Collabora Online Development Edition|${APP_NAME}|g" /usr/src/collabora-online/browser/src/control/Toolbar.js && \
sed -i "s|Collabora Online Development Edition|${APP_NAME}|g" /usr/src/collabora-online/browser/src/core/Socket.js && \
sed -i "s|Collabora Online Development Edition|${APP_NAME}|g" /usr/src/collabora-online/browser/src/layer/marker/ProgressOverlay.js && \
sed -i "s|Collabora Online Development Edition|${APP_NAME}|g" /usr/src/collabora-online/browser/src/map/Clipboard.js && \
sed -i "s|Collabora Online Development Edition|${APP_NAME}|g" /usr/src/collabora-online/browser/welcome/*.html && \
2018-09-17 14:33:41 +02:00
./autogen.sh && \
./configure --enable-silent-rules \
2021-02-20 03:51:09 +01:00
--with-lokit-path="/usr/src/libreoffice-core/include" \
2018-09-17 14:33:41 +02:00
--with-lo-path=/opt/libreoffice \
2018-03-24 21:07:22 +01:00
--with-max-connections=${MAX_CONNECTIONS} \
--with-max-documents=${MAX_DOCUMENTS} \
2021-12-03 04:26:38 +01:00
--with-logfile=/var/log/cool/cool.log \
--prefix=/opt/cool \
2018-03-24 21:07:22 +01:00
--sysconfdir=/etc \
2021-02-20 03:51:09 +01:00
--localstatedir=/var \
--with-poco-includes=/opt/poco/include \
--with-poco-libs=/opt/poco/lib \
2021-04-10 01:15:54 +02:00
--with-app-name="${APP_NAME}" \
--with-vendor="tiredofit@github" \
2021-02-20 03:51:09 +01:00
&& \
2021-12-03 04:26:38 +01:00
#( scripts/locorestrings.py /usr/src/collabora-online /usr/src/libreoffice-core/translations ) && \
2021-02-20 03:51:09 +01:00
make -j$(nproc) && \
2021-12-03 04:26:38 +01:00
mkdir -p /opt/cool && \
chown -R cool /opt/cool && \
cp -R coolwsd.xml /opt/cool/ && \
cp -R coolkitconfig.xcu /opt/cool && \
2018-09-17 14:33:41 +02:00
make install && \
2021-02-20 03:51:09 +01:00
\
### Cleanup
2019-02-28 17:02:34 +01:00
cd / && \
2018-09-17 14:33:41 +02:00
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/*
2018-03-24 21:07:22 +01:00
2021-12-03 04:26:38 +01:00
FROM docker.io/tiredofit/debian:bullseye
2018-09-17 14:33:41 +02:00
LABEL maintainer="Dave Conroy (dave at tiredofit dot ca)"
### Set Defaults
ENV ADMIN_USER=admin \
2021-12-03 04:26:38 +01:00
ADMIN_PASS=collaboraonline \
2022-02-10 21:22:00 +01:00
CONTAINER_ENABLE_MESSAGING=FALSE \
IMAGE_NAME="tiredofit/collabora-online" \
IMAGE_REPO_URL="https://github.com/tiredofit/docker-collabora-online/"
2018-09-17 14:33:41 +02:00
### Grab Compiled Assets from builder image
COPY --from=builder /opt/ /opt/
2021-02-20 03:51:09 +01:00
ADD build-assets /build-assets
2018-09-17 14:33:41 +02:00
### Install Dependencies
2019-02-28 17:02:34 +01:00
RUN set -x && \
2021-12-03 04:26:38 +01:00
adduser --quiet --system --group --home /opt/cool cool && \
2019-02-28 17:02:34 +01:00
\
### Add Repositories
2021-12-03 04:26:38 +01:00
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 && \
2018-09-17 14:33:41 +02:00
echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections && \
2021-04-11 21:00:55 +02:00
apt-get update && \
2019-07-08 00:09:06 +02:00
apt-get -o Dpkg::Options::="--force-confold" upgrade -y && \
2018-09-17 14:33:41 +02:00
apt-get install -y\
apt-transport-https \
cpio \
findutils \
2021-02-20 03:51:09 +01:00
fontconfig \
2019-02-28 17:02:34 +01:00
hunspell \
2021-02-20 03:51:09 +01:00
hunspell-en-ca \
2019-02-28 17:02:34 +01:00
hunspell-en-gb \
2021-02-20 03:51:09 +01:00
hunspell-en-us \
inotify-tools \
libcap2-bin \
2018-09-17 14:33:41 +02:00
libcups2 \
libfontconfig1 \
libfreetype6 \
libgl1-mesa-glx \
libpam0g \
2019-02-28 17:02:34 +01:00
libpng16-16 \
libsm6 \
2021-02-20 03:51:09 +01:00
libubsan1 \
2018-09-17 14:33:41 +02:00
libxcb-render0 \
libxcb-shm0 \
libxinerama1 \
libxrender1 \
locales \
2018-09-17 14:33:41 +02:00
locales-all \
2021-02-20 03:51:09 +01:00
openssl \
openssh-client \
procps \
2018-09-17 14:33:41 +02:00
python3-requests \
python3-websocket \
ttf-mscorefonts-installer \
&& \
\
2018-03-24 21:07:22 +01:00
### Setup Directories and Permissions
2021-12-03 04:26:38 +01:00
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 && \
2018-03-24 21:07:22 +01:00
mkdir -p /usr/share/hunspell && \
mkdir -p /usr/share/hyphen && \
mkdir -p /usr/share/mythes && \
2021-12-03 04:26:38 +01:00
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 && \
2018-09-17 14:33:41 +02:00
\
2018-03-24 21:07:22 +01:00
### Setup LibreOffice Online Jails
2021-12-03 04:26:38 +01:00
sudo -u cool /opt/cool/bin/coolwsd-systemplate-setup /opt/cool/systemplate /opt/libreoffice && \
2018-09-17 14:33:41 +02:00
\
2021-02-20 03:51:09 +01:00
if [ -d "/build-assets/container/src" ] ; then cp -R /build-assets/container/src/* /usr/src/libreoffice-container ; fi; \
if [ -d "/build-assets/container/scripts" ] ; then for script in /build-assets/container/scripts/*.sh; do echo "** Applying $script"; bash $script; done && \ ; fi ; \
2018-09-17 14:33:41 +02:00
apt-get autoremove -y && \
2018-03-24 21:07:22 +01:00
apt-get clean && \
2018-09-17 14:33:41 +02:00
\
2018-03-24 21:07:22 +01:00
rm -rf /usr/src/* && \
rm -rf /usr/share/doc && \
rm -rf /usr/share/man && \
rm -rf /var/lib/apt/lists/* && \
2018-09-17 14:33:41 +02:00
rm -rf /var/log/* && \
2021-02-20 03:51:09 +01:00
rm -rf /build-assets && \
rm -rf /tmp/*
2018-03-24 21:07:22 +01:00
### Networking Configuration
EXPOSE 9980
### Assets
ADD install /