docker-collabora-online/Dockerfile

278 lines
8.9 KiB
Docker
Raw Normal View History

2019-02-28 17:04:10 +01:00
FROM tiredofit/debian:stretch as builder
2018-03-24 21:07:22 +01:00
LABEL maintainer="Dave Conroy (dave at tiredofit dot ca)"
### Set Environment Variables
2018-09-17 14:33:41 +02:00
ENV LIBREOFFICE_BRANCH=master \
## cp-6.0.30
LIBREOFFICE_COMMIT=3ef1164bc3a13af481102e0abef06929c53bad8b \
2018-03-24 21:07:22 +01:00
LOOL_BRANCH=master \
## 4.0.4.1
LOOL_COMMIT=a2132266584381c875fa707446417e259753e2f5 \
2018-09-17 14:33:41 +02:00
MAX_CONNECTIONS=5000 \
## Uses Approximately 20mb per document open
2019-02-28 17:02:34 +01:00
MAX_DOCUMENTS=5000 \
POCO_VERSION=1.9.0
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 && \
echo "deb-src http://deb.debian.org/debian stretch main" >> /etc/apt/sources.list && \
2019-02-28 17:02:34 +01:00
echo "deb http://deb.debian.org/debian stretch contrib" >> /etc/apt/sources.list && \
2018-03-24 21:07:22 +01:00
curl -sL https://deb.nodesource.com/setup_6.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
\
mkdir -p /home/lool && \
useradd lool -G sudo && \
chown lool:lool /home/lool -R && \
\
## Add Build Dependencies
2018-03-24 21:07:22 +01:00
apt-get install -y \
cpio \
git \
libcap-dev \
2018-09-17 14:33:41 +02:00
libghc-zlib-dev \
2018-03-24 21:07:22 +01:00
libpam0g-dev \
libssl-dev \
2018-03-24 21:07:22 +01:00
libtool \
2019-02-28 17:02:34 +01:00
nasm \
2018-03-24 21:07:22 +01:00
nodejs \
openssl \
2018-03-24 21:07:22 +01:00
python-polib \
sudo \
2018-09-17 14:33:41 +02:00
translate-toolkit \
2018-03-24 21:07:22 +01:00
ttf-mscorefonts-installer \
wget \
&& \
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
\
2019-02-28 17:02:34 +01:00
### Build and Install Poco Libraries
mkdir -p /usr/src/poco && \
curl -sSL https://pocoproject.org/releases/poco-${POCO_VERSION}/poco-${POCO_VERSION}-all.tar.gz | tar xvfz - --strip 1 -C /usr/src/poco && \
cd /usr/src/poco && \
./configure \
--no-samples \
--no-tests \
--prefix=/opt/poco \
&& \
make install && \
\
2018-09-17 14:33:41 +02:00
### Build Fetch LibreOffice - This will take a while..
git clone -b ${LIBREOFFICE_BRANCH} https://github.com/LibreOffice/core.git /usr/src/libreoffice-core && \
2018-03-24 21:07:22 +01:00
cd /usr/src/libreoffice-core && \
2018-09-17 14:33:41 +02:00
echo "lo_sources_ver="`env | grep LIBREOFFICE_VERSION | cut -d'-' -f2` > sources.ver && \
2018-03-24 21:07:22 +01:00
git reset --hard ${LIBREOFFICE_COMMIT} && \
2018-09-17 14:33:41 +02:00
git submodule init && \
git submodule update translations && \
git submodule update dictionaries && \
cd /usr/src/libreoffice-core && \
2018-03-24 21:07:22 +01:00
echo "--disable-dbus \n\
--disable-dconf \n\
--disable-epm \n\
--disable-evolution2 \n\
--disable-ext-nlpsolver \n\
--disable-ext-wiki-publisher \n\
--disable-firebird-sdbc \n\
--disable-gio \n\
--disable-gstreamer-0-10 \n\
--disable-gstreamer-1-0 \n\
--disable-gtk \n\
--disable-gtk3 \n\
--disable-kde4 \n\
--disable-odk \n\
--disable-online-update \n\
--disable-pdfimport \n\
--disable-postgresql-sdbc \n\
--disable-report-builder \n\
--disable-scripting-beanshell \n\
--disable-scripting-javascript \n\
--disable-sdremote \n\
--disable-sdremote-bluetooth \n\
--enable-extension-integration \n\
--enable-mergelibs \n\
--enable-python=internal \n\
--enable-release-build \n\
--with-external-dict-dir=/usr/share/hunspell \n\
--with-external-hyph-dir=/usr/share/hyphen \n\
--with-external-thes-dir=/usr/share/mythes \n\
--with-fonts \n\
--with-galleries=no \n\
2018-09-17 14:33:41 +02:00
--with-lang=en-GB en-US\n\
2018-03-24 21:07:22 +01:00
--with-linker-hash-style=both \n\
--with-system-dicts \n\
--with-system-zlib \n\
2018-09-17 14:33:41 +02:00
--with-theme=galaxy \n\
2019-02-28 17:02:34 +01:00
#--with-system-xmlsec \n\
2018-03-24 21:07:22 +01:00
--without-branding \n\
--without-help \n\
--without-java \n\
--without-junit \n\
--without-myspell-dicts \n\
--without-package-format \n\
--without-system-jars \n\
--without-system-jpeg \n\
--without-system-libpng \n\
--without-system-libxml \n\
--without-system-openssl \n\
--without-system-poppler \n\
--without-system-postgresql \n\
--prefix=/opt/libreoffice \n\
" > /usr/src/libreoffice-core/distro-configs/LibreOfficeOnline.conf && \
2018-09-17 14:33:41 +02:00
./autogen.sh --with-distro="LibreOfficeOnline" && \
2019-02-28 17:02:34 +01:00
cd /usr/src/libreoffice-core && \
sed -i "s/export XMLSEC_TARBALL := xmlsec1-1.2.26.tar.gz/export XMLSEC_TARBALL := xmlsec1-1.2.25.tar.gz/g" download.lst && \
2018-09-17 14:33:41 +02:00
chown -R lool /usr/src/libreoffice-core && \
2018-03-24 21:07:22 +01:00
sudo -u lool make && \
cd /usr/src/libreoffice-core && \
mkdir -p /opt/libreoffice && \
chown -R lool /opt/libreoffice && \
sudo -u lool make install && \
2018-09-17 14:33:41 +02:00
cp -R /usr/src/libreoffice-core/instdir/* /opt/libreoffice/ && \
\
2018-03-24 21:07:22 +01:00
### Build LibreOffice Online (Not as long as above)
2018-09-17 14:33:41 +02:00
git clone -b ${LOOL_BRANCH} https://github.com/LibreOffice/online.git /usr/src/libreoffice-online && \
cd /usr/src/libreoffice-online && \
git reset --hard ${LOOL_COMMIT} && \
npm install -g \
bootstrap \
browserify-css \
d3 \
d3 \
eslint \
evol-colorpicker \
exorcist \
jake \
npm \
uglify-js \
&& \
\
./autogen.sh && \
./configure --enable-silent-rules \
2018-03-24 21:07:22 +01:00
--with-lokit-path=/usr/src/libreoffice-online/bundled/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} \
2019-02-28 17:02:34 +01:00
--with-poco-includes=/opt/poco/include \
--with-poco-libs=/opt/poco/lib \
2018-03-24 21:07:22 +01:00
--with-logfile=/var/log/lool/lool.log \
--prefix=/opt/lool \
--sysconfdir=/etc \
--localstatedir=/var && \
2018-09-17 14:33:41 +02:00
( cd loleaflet/po && ../../scripts/downloadpootle.sh ) && \
( cd loleaflet && make l10n) || exit 1 && \
( scripts/locorestrings.py /usr/src/libreoffice-online /usr/src/libreoffice-core/translations ) && \
make -j`nproc` && \
2018-03-24 21:07:22 +01:00
mkdir -p /opt/lool && \
chown -R lool /opt/lool && \
2018-09-17 14:33:41 +02:00
cp -R loolwsd.xml /opt/lool/ && \
cp -R loolkitconfig.xcu /opt/lool && \
make install && \
2019-02-28 17:02:34 +01:00
cd / && \
2018-09-17 14:33:41 +02:00
apt-get autoremove -y && \
apt-get clean && \
### Cleanup
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
2019-02-28 17:04:10 +01:00
FROM tiredofit/debian:stretch
2018-09-17 14:33:41 +02:00
LABEL maintainer="Dave Conroy (dave at tiredofit dot ca)"
### Set Defaults
ENV ADMIN_USER=admin \
ADMIN_PASS=libreoffice \
LOG_LEVEL=warning \
DICTIONARIES="en_GB en_US" \
ENABLE_SMTP=false \
PYTHONWARNINGS=ignore
### Grab Compiled Assets from builder image
COPY --from=builder /opt/ /opt/
### Install Dependencies
2019-02-28 17:02:34 +01:00
RUN set -x && \
adduser --quiet --system --group --home /opt/lool lool && \
\
### Add Repositories
echo "deb http://deb.debian.org/debian stretch contrib" >> /etc/apt/sources.list && \
curl -sL https://deb.nodesource.com/setup_6.x | bash - && \
\
2018-09-17 14:33:41 +02:00
echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections && \
2019-02-28 17:02:34 +01:00
apt-get upgrade -y && \
2018-09-17 14:33:41 +02:00
apt-get install -y\
adduser \
apt-transport-https \
cpio \
findutils \
fonts-droid-fallback \
fonts-noto-cjk \
2019-02-28 17:02:34 +01:00
hunspell \
hunspell-en-us \
hunspell-en-gb \
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 \
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 \
openssl \
2018-09-17 14:33:41 +02:00
python3-requests \
python3-websocket \
sudo \
ttf-mscorefonts-installer \
&& \
\
2018-03-24 21:07:22 +01:00
### Setup Directories and Permissions
2018-09-17 14:33:41 +02:00
mkdir -p /etc/loolwsd && \
mv /opt/lool/loolwsd.xml /etc/loolwsd/ && \
mv /opt/lool/loolkitconfig.xcu /etc/loolwsd/ && \
chown -R lool /etc/loolwsd && \
2018-03-24 21:07:22 +01:00
mkdir -p /opt/lool/jails && \
chown -R lool /opt/* && \
mkdir -p /var/cache/loolwsd && \
chown -R lool /var/cache/loolwsd && \
setcap cap_fowner,cap_mknod,cap_sys_chroot=ep /opt/lool/bin/loolforkit && \
2019-02-28 17:02:34 +01:00
# setcap cap_sys_admin=ep /opt/lool/bin/loolmount && \
2018-03-24 21:07:22 +01:00
mkdir -p /usr/share/hunspell && \
mkdir -p /usr/share/hyphen && \
mkdir -p /usr/share/mythes && \
2018-09-17 14:33:41 +02:00
\
2018-03-24 21:07:22 +01:00
### Setup LibreOffice Online Jails
2018-09-17 14:33:41 +02:00
sudo -u lool /opt/lool/bin/loolwsd-systemplate-setup /opt/lool/systemplate /opt/libreoffice && \
\
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/* && \
2019-02-28 17:02:34 +01:00
rm -rf /tmp/* && \
2018-09-17 14:33:41 +02:00
mkdir -p /var/log/lool && \
2019-02-28 17:02:34 +01:00
touch /var/log/lool/loolwsd.log && \
2018-09-17 14:33:41 +02:00
chown -R lool /var/log/lool
2018-03-24 21:07:22 +01:00
### Networking Configuration
EXPOSE 9980
### Assets
ADD install /