diff --git a/8.2-nextcloud/Dockerfile b/8.2-nextcloud/Dockerfile index 6b1c809..5a71c4a 100644 --- a/8.2-nextcloud/Dockerfile +++ b/8.2-nextcloud/Dockerfile @@ -13,10 +13,37 @@ LABEL org.opencontainers.image.version="8.2" # Fix hadolint #DL4006 (https://github.com/hadolint/hadolint/wiki/DL4006) SHELL ["/bin/bash", "-o", "pipefail", "-c"] +RUN apt-get update + +# ----------------------------------------------------------------- Install cron +RUN apt-get install -y --no-install-recommends \ + busybox-static && \ + mkdir -p /var/spool/cron/crontabs && \ + echo '*/5 * * * * php -f /var/www/cron.php' > /var/spool/cron/crontabs/www-data +COPY --chmod=755 cron.sh / + + +# ------------------------------------------------------------------ Supervisord +RUN apt-get install -y --no-install-recommends \ + # Install supervisor to start multiple processes on container startup \ + supervisor +RUN mkdir "/var/run/supervisor" +RUN rm -rf /etc/supervisor/* +COPY supervisor/*.conf /etc/supervisor +COPY supervisor/*.sh / + + +# ----------------------------------------------------- Install Search and cron utilities +RUN apt-get install -y --no-install-recommends \ + # Install tesseract and ocrmypdf for OCR \ + tesseract-ocr \ + tesseract-ocr-fra \ + tesseract-ocr-eng \ + ocrmypdf + # ------------------------------------------------------------ Install utilities -RUN apt-get update && \ - apt-get install -y --no-install-recommends \ +RUN apt-get install -y --no-install-recommends \ # Misc tools \ bzip2 \ curl \ @@ -27,9 +54,9 @@ RUN apt-get update && \ libmagickcore-6.q16-6-extra \ libpng16-16 \ libzip4 \ + procps \ unzip \ - wget && \ - rm -rf /var/lib/apt/lists/* + wget # --------------------------------------------------------- Install dependancies @@ -54,7 +81,6 @@ RUN fetchDeps=" \ # Build dependencies for Zip \ libzip-dev \ # Misc build dependencies \ - busybox-static \ libcurl4-openssl-dev \ libevent-dev \ libmcrypt-dev \ @@ -103,7 +129,11 @@ RUN fetchDeps=" \ \ # ------------------------------------------------------------------ Big cleanup \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false ${fetchDeps}; \ - rm -rf /var/lib/apt/lists/* + apt clean && \ + rm -rf /var/lib/apt/lists/* \ + /tmp/* \ + /var/tmp/* \ + /usr/share/doc/* # -------------------------------------------------- Install php-fpm-healthcheck @@ -117,9 +147,11 @@ RUN sed -i 's#^;pm.status_path = .*#pm.status_path = /status#g' /usr/local/etc/p COPY php.d /usr/local/etc/php/conf.d COPY etc /usr/local/etc/php - # Healthcheck HEALTHCHECK --interval=1m --timeout=10s --start-period=1m --retries=3 CMD FCGI_CONNECT=localhost:9000 php-fpm-healthcheck EXPOSE 9000 WORKDIR /var/www + +ENTRYPOINT [] +CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"] diff --git a/8.2-nextcloud/cron.sh b/8.2-nextcloud/cron.sh new file mode 100644 index 0000000..4dfa411 --- /dev/null +++ b/8.2-nextcloud/cron.sh @@ -0,0 +1,4 @@ +#!/bin/sh +set -eu + +exec busybox crond -f -l 0 -L /dev/stdout diff --git a/8.2-nextcloud/supervisor/nc_fulltextsearch_live.sh b/8.2-nextcloud/supervisor/nc_fulltextsearch_live.sh new file mode 100644 index 0000000..1abb3fe --- /dev/null +++ b/8.2-nextcloud/supervisor/nc_fulltextsearch_live.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +# If fulltextsearch is present: stop all running indexes before start live. +[ -d /var/www/apps/fulltextsearch ] && echo php /var/www/occ fulltextsearch:stop + +# If fulltextsearch is present: start live index +[ -d /var/www/apps/fulltextsearch ] && php /var/www/occ fulltextsearch:live diff --git a/8.2-nextcloud/supervisor/supervisord.conf b/8.2-nextcloud/supervisor/supervisord.conf new file mode 100644 index 0000000..74838bf --- /dev/null +++ b/8.2-nextcloud/supervisor/supervisord.conf @@ -0,0 +1,34 @@ +; Inspired by https://github.com/nextcloud/docker/blob/master/.examples/dockerfiles/cron/apache/supervisord.conf +[supervisord] +nodaemon=true +user=root +logfile=/var/log/supervisor/supervisord.log +pidfile=/var/run/supervisor/supervisord.pid +childlogdir=/var/log/supervisor/ +logfile_maxbytes=50MB ; maximum size of logfile before rotation +logfile_backups=10 ; number of backed up logfiles +loglevel=error + +[program:php-fpm] +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 +user=root # Run as root because using config to start process like www-data. +command=php-fpm + +[program:cron] +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 +user=root +command=/cron.sh + +[program:fulltextsearch_index_live] +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 +user=www-data +command=/bin/sh /nc_fulltextsearch_live.sh