diff --git a/.examples/README.md b/.examples/README.md index 0b381ee5..c9843b4b 100644 --- a/.examples/README.md +++ b/.examples/README.md @@ -59,9 +59,8 @@ The required steps for each optional/recommended package that is not already in `apt install LibreOffice`
#### CRON via supervisor -`apt install supervisor cron`
+`apt install supervisor`
`mkdir /var/log/supervisord /var/run/supervisord`
-`echo "*/15 * * * * su - www-data -s /bin/bash -c \"php -f /var/www/html/cron.php\""| crontab -`
The following Dockerfile commands are also necessary for a sucessfull cron installation:
`COPY supervisord.conf /etc/supervisor/supervisord.conf`
`CMD ["/usr/bin/supervisord"]`
diff --git a/.examples/docker-compose/insecure/mariadb-cron-redis/apache/docker-compose.yml b/.examples/docker-compose/insecure/mariadb-cron-redis/apache/docker-compose.yml index 87760d6b..ab307200 100644 --- a/.examples/docker-compose/insecure/mariadb-cron-redis/apache/docker-compose.yml +++ b/.examples/docker-compose/insecure/mariadb-cron-redis/apache/docker-compose.yml @@ -36,20 +36,7 @@ services: restart: always volumes: - nextcloud:/var/www/html - user: www-data - entrypoint: | - bash -c 'bash -s <> /etc/apt/sources.list \ && apt-get update && apt-get install -y \ supervisor \ - cron \ ffmpeg \ libmagickwand-dev \ libgmp3-dev \ @@ -18,8 +17,7 @@ RUN echo "deb http://ftp.debian.org/debian jessie-backports main" >> /etc/apt/so && docker-php-ext-install bz2 gmp imap \ && pecl install imagick smbclient \ && docker-php-ext-enable imagick smbclient \ - && mkdir /var/log/supervisord /var/run/supervisord \ - && echo "*/15 * * * * su - www-data -s /bin/bash -c \"php -f /var/www/html/cron.php\""| crontab - + && mkdir /var/log/supervisord /var/run/supervisord COPY supervisord.conf /etc/supervisor/supervisord.conf diff --git a/.examples/dockerfiles/full/apache/supervisord.conf b/.examples/dockerfiles/full/apache/supervisord.conf index 25ae32f8..836a08ad 100644 --- a/.examples/dockerfiles/full/apache/supervisord.conf +++ b/.examples/dockerfiles/full/apache/supervisord.conf @@ -19,4 +19,4 @@ stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 -command=cron -f +command=/cron.sh diff --git a/.examples/dockerfiles/full/fpm/Dockerfile b/.examples/dockerfiles/full/fpm/Dockerfile index af37cd53..4798db42 100644 --- a/.examples/dockerfiles/full/fpm/Dockerfile +++ b/.examples/dockerfiles/full/fpm/Dockerfile @@ -3,7 +3,6 @@ FROM nextcloud:fpm RUN echo "deb http://ftp.debian.org/debian jessie-backports main" >> /etc/apt/sources.list \ && apt-get update && apt-get install -y \ supervisor \ - cron \ ffmpeg \ libmagickwand-dev \ libgmp3-dev \ @@ -18,8 +17,7 @@ RUN echo "deb http://ftp.debian.org/debian jessie-backports main" >> /etc/apt/so && docker-php-ext-install bz2 gmp imap \ && pecl install imagick smbclient \ && docker-php-ext-enable imagick smbclient \ - && mkdir /var/log/supervisord /var/run/supervisord \ - && echo "*/15 * * * * su - www-data -s /bin/bash -c \"php -f /var/www/html/cron.php\""| crontab - + && mkdir /var/log/supervisord /var/run/supervisord COPY supervisord.conf /etc/supervisor/supervisord.conf diff --git a/.examples/dockerfiles/full/fpm/supervisord.conf b/.examples/dockerfiles/full/fpm/supervisord.conf index ff27295f..4f762592 100644 --- a/.examples/dockerfiles/full/fpm/supervisord.conf +++ b/.examples/dockerfiles/full/fpm/supervisord.conf @@ -19,4 +19,4 @@ stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 -command=cron -f +command=/cron.sh diff --git a/11.0/apache/Dockerfile b/11.0/apache/Dockerfile index 6d025884..2c42d99f 100644 --- a/11.0/apache/Dockerfile +++ b/11.0/apache/Dockerfile @@ -6,7 +6,10 @@ RUN set -ex; \ apt-get install -y --no-install-recommends \ rsync \ bzip2 \ + busybox-static \ ; \ + mkdir -p /var/spool/cron/crontabs; \ + echo '*/15 * * * * php -f /var/www/html/cron.php' > /var/spool/cron/crontabs/www-data; \ # install the PHP extensions we need # see https://docs.nextcloud.com/server/12/admin_manual/installation/source_installation.html \ @@ -86,7 +89,7 @@ RUN set -ex; \ mkdir -p /usr/src/nextcloud/custom_apps; \ chmod +x /usr/src/nextcloud/occ -COPY docker-entrypoint.sh /entrypoint.sh +COPY *.sh / COPY config/* /usr/src/nextcloud/config/ ENTRYPOINT ["/entrypoint.sh"] diff --git a/11.0/apache/cron.sh b/11.0/apache/cron.sh new file mode 100755 index 00000000..bb65a1fb --- /dev/null +++ b/11.0/apache/cron.sh @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +exec busybox crond -f -l 0 -L /dev/stdout diff --git a/11.0/apache/docker-entrypoint.sh b/11.0/apache/entrypoint.sh similarity index 100% rename from 11.0/apache/docker-entrypoint.sh rename to 11.0/apache/entrypoint.sh diff --git a/11.0/fpm/Dockerfile b/11.0/fpm/Dockerfile index 5483acf4..e10bb75d 100644 --- a/11.0/fpm/Dockerfile +++ b/11.0/fpm/Dockerfile @@ -6,7 +6,10 @@ RUN set -ex; \ apt-get install -y --no-install-recommends \ rsync \ bzip2 \ + busybox-static \ ; \ + mkdir -p /var/spool/cron/crontabs; \ + echo '*/15 * * * * php -f /var/www/html/cron.php' > /var/spool/cron/crontabs/www-data; \ # install the PHP extensions we need # see https://docs.nextcloud.com/server/12/admin_manual/installation/source_installation.html \ @@ -85,7 +88,7 @@ RUN set -ex; \ mkdir -p /usr/src/nextcloud/custom_apps; \ chmod +x /usr/src/nextcloud/occ -COPY docker-entrypoint.sh /entrypoint.sh +COPY *.sh / COPY config/* /usr/src/nextcloud/config/ ENTRYPOINT ["/entrypoint.sh"] diff --git a/11.0/fpm/cron.sh b/11.0/fpm/cron.sh new file mode 100755 index 00000000..bb65a1fb --- /dev/null +++ b/11.0/fpm/cron.sh @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +exec busybox crond -f -l 0 -L /dev/stdout diff --git a/11.0/fpm/docker-entrypoint.sh b/11.0/fpm/entrypoint.sh similarity index 100% rename from 11.0/fpm/docker-entrypoint.sh rename to 11.0/fpm/entrypoint.sh diff --git a/12.0/apache/Dockerfile b/12.0/apache/Dockerfile index d4edac22..4a3e8673 100644 --- a/12.0/apache/Dockerfile +++ b/12.0/apache/Dockerfile @@ -6,7 +6,10 @@ RUN set -ex; \ apt-get install -y --no-install-recommends \ rsync \ bzip2 \ + busybox-static \ ; \ + mkdir -p /var/spool/cron/crontabs; \ + echo '*/15 * * * * php -f /var/www/html/cron.php' > /var/spool/cron/crontabs/www-data; \ # install the PHP extensions we need # see https://docs.nextcloud.com/server/12/admin_manual/installation/source_installation.html \ @@ -86,7 +89,7 @@ RUN set -ex; \ mkdir -p /usr/src/nextcloud/custom_apps; \ chmod +x /usr/src/nextcloud/occ -COPY docker-entrypoint.sh /entrypoint.sh +COPY *.sh / COPY config/* /usr/src/nextcloud/config/ ENTRYPOINT ["/entrypoint.sh"] diff --git a/12.0/apache/cron.sh b/12.0/apache/cron.sh new file mode 100755 index 00000000..bb65a1fb --- /dev/null +++ b/12.0/apache/cron.sh @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +exec busybox crond -f -l 0 -L /dev/stdout diff --git a/12.0/apache/docker-entrypoint.sh b/12.0/apache/entrypoint.sh similarity index 100% rename from 12.0/apache/docker-entrypoint.sh rename to 12.0/apache/entrypoint.sh diff --git a/12.0/fpm/Dockerfile b/12.0/fpm/Dockerfile index 0bb92dd2..2b6dca09 100644 --- a/12.0/fpm/Dockerfile +++ b/12.0/fpm/Dockerfile @@ -6,7 +6,10 @@ RUN set -ex; \ apt-get install -y --no-install-recommends \ rsync \ bzip2 \ + busybox-static \ ; \ + mkdir -p /var/spool/cron/crontabs; \ + echo '*/15 * * * * php -f /var/www/html/cron.php' > /var/spool/cron/crontabs/www-data; \ # install the PHP extensions we need # see https://docs.nextcloud.com/server/12/admin_manual/installation/source_installation.html \ @@ -85,7 +88,7 @@ RUN set -ex; \ mkdir -p /usr/src/nextcloud/custom_apps; \ chmod +x /usr/src/nextcloud/occ -COPY docker-entrypoint.sh /entrypoint.sh +COPY *.sh / COPY config/* /usr/src/nextcloud/config/ ENTRYPOINT ["/entrypoint.sh"] diff --git a/12.0/fpm/cron.sh b/12.0/fpm/cron.sh new file mode 100755 index 00000000..bb65a1fb --- /dev/null +++ b/12.0/fpm/cron.sh @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +exec busybox crond -f -l 0 -L /dev/stdout diff --git a/12.0/fpm/docker-entrypoint.sh b/12.0/fpm/entrypoint.sh similarity index 100% rename from 12.0/fpm/docker-entrypoint.sh rename to 12.0/fpm/entrypoint.sh diff --git a/Dockerfile.template b/Dockerfile.template index f0d8bc8d..dc7b8cb3 100644 --- a/Dockerfile.template +++ b/Dockerfile.template @@ -6,7 +6,10 @@ RUN set -ex; \ apt-get install -y --no-install-recommends \ rsync \ bzip2 \ + busybox-static \ ; \ + mkdir -p /var/spool/cron/crontabs; \ + echo '*/15 * * * * php -f /var/www/html/cron.php' > /var/spool/cron/crontabs/www-data; \ # install the PHP extensions we need # see https://docs.nextcloud.com/server/12/admin_manual/installation/source_installation.html \ @@ -85,7 +88,7 @@ RUN set -ex; \ mkdir -p /usr/src/nextcloud/custom_apps; \ chmod +x /usr/src/nextcloud/occ -COPY docker-entrypoint.sh /entrypoint.sh +COPY *.sh / COPY config/* /usr/src/nextcloud/config/ ENTRYPOINT ["/entrypoint.sh"] diff --git a/docker-cron.sh b/docker-cron.sh new file mode 100755 index 00000000..bb65a1fb --- /dev/null +++ b/docker-cron.sh @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +exec busybox crond -f -l 0 -L /dev/stdout diff --git a/update.sh b/update.sh index 2920d073..2fb6f4c0 100755 --- a/update.sh +++ b/update.sh @@ -51,8 +51,10 @@ for latest in "${latests[@]}"; do s/%%VARIANT_EXTRAS%%/'"${extras[$variant]}"'/g; ' "$version/$variant/Dockerfile" - # Copy the docker-entrypoint. - cp docker-entrypoint.sh "$version/$variant/docker-entrypoint.sh" + # Copy the shell scripts + for name in entrypoint cron; do + cp "docker-$name.sh" "$version/$variant/$name.sh" + done # Copy the config directory cp -rT .config "$version/$variant/config"