libreoffice-online/docker/from-packages/RHEL8
Ashod Nakashian e1ff82324e docker: exec the startup script to intercept SIGTERM
Docker supports two methods of executing commands.
The existing approach was to run bash and give the
shell script to execute, which forks and execs another
shell instance to run the script. This means that the
script itself is not PID 1, rather the parent bash
instance is.
The second approach is to exec the script in the same
bash process, without a parent. This is exactly what
we want, because once our script is done, it execs
loolwsd, thereby making loolwsd PID 1.

All of this means that when the docker container is
stopped, and PID 1 is sent SIGTERM, loolwsd will
intercept it and gracefully shutdown.

Change-Id: I52ac63f7fba58d20d1c6f63c7e07dd18141c1af4
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-10-12 09:36:33 +02:00

42 lines
1.3 KiB
Text
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
FROM registry.access.redhat.com/ubi8/ubi:8.1
# repo: can be 'repos', 'repos-staging', 'repos-snapshot'
# Optional. The default is 'repos'.
ARG repo
# version: can be '4.2', '6.4'
# Optional. The default is '6.4'.
ARG version
# type: can be
# 'code' - Collabora Online Development Edition
# 'cool' - Collabora Online, to build this you need to give your secret URL part from https://support.collaboraoffice.com, i.e. you have to be Collabora partner or customer
# 'key' - Collabora Online, the license key enabled version.
# Optional. The default is 'code'.
ARG type
# secret_key is the URL hash from https://support.collaboraoffice.com
# Mandatory, when you build 'cool', otherwise not needed.
ARG secret_key
# Environment variables
ENV domain localhost
ENV LC_CTYPE C.UTF-8
# Setup scripts for Collabora Online
ADD /scripts/install-collabora-online-rhel8.sh /
ADD /scripts/start-collabora-online.sh /
RUN bash install-collabora-online-rhel8.sh
RUN rm -rf /install-collabora-online-rhel8.sh
EXPOSE 9980
# switch to lool user (use numeric user id to be compatible with Kubernetes Pod Security Policies)
USER 998
# Entry point
CMD ["/start-collabora-online.sh"]