diff --git a/.examples/README.md b/.examples/README.md index 4e46b4a..d218344 100644 --- a/.examples/README.md +++ b/.examples/README.md @@ -13,7 +13,7 @@ The Dockerfiles use the default images as base image and build on top of it. Example | Description ------- | ------- -[cron](https://github.com/nextcloud/docker/tree/master/.examples/dockerfiles/cron) | uses supervisor to run the cron job inside the container (so no extra container is needed). +[cron](https://github.com/nextcloud/docker/tree/master/.examples/dockerfiles/cron) | uses supervisor to run the cron job inside the container (so no extra container is needed). This image runs `supervisord` to start nextcloud and cron as two seperate processes inside the container. [imap](https://github.com/nextcloud/docker/tree/master/.examples/dockerfiles/imap) | adds dependencies required to authenticate users via imap [smb](https://github.com/nextcloud/docker/tree/master/.examples/dockerfiles/smb) | adds dependencies required to use smb shares [full](https://github.com/nextcloud/docker/tree/master/.examples/dockerfiles/full) | adds dependencies for ALL optional packages and cron functionality via supervisor (as in the `cron` example Dockerfile). diff --git a/.examples/dockerfiles/cron/apache/Dockerfile b/.examples/dockerfiles/cron/apache/Dockerfile index 2a6f3e7..85445b5 100644 --- a/.examples/dockerfiles/cron/apache/Dockerfile +++ b/.examples/dockerfiles/cron/apache/Dockerfile @@ -7,4 +7,6 @@ RUN apt-get update && apt-get install -y \ COPY supervisord.conf /etc/supervisor/supervisord.conf +ENV NEXTCLOUD_UPDATE=1 + CMD ["/usr/bin/supervisord"] diff --git a/.examples/dockerfiles/cron/fpm/Dockerfile b/.examples/dockerfiles/cron/fpm/Dockerfile index 1e4b402..5bf88ff 100644 --- a/.examples/dockerfiles/cron/fpm/Dockerfile +++ b/.examples/dockerfiles/cron/fpm/Dockerfile @@ -7,4 +7,6 @@ RUN apt-get update && apt-get install -y \ COPY supervisord.conf /etc/supervisor/supervisord.conf +ENV NEXTCLOUD_UPDATE=1 + CMD ["/usr/bin/supervisord"] diff --git a/.travis/test-example-dockerfiles.sh b/.travis/test-example-dockerfiles.sh index 9cc4c4c..2598ed6 100755 --- a/.travis/test-example-dockerfiles.sh +++ b/.travis/test-example-dockerfiles.sh @@ -13,7 +13,6 @@ for dir in "${dirs[@]}"; do cd "$dir/$VARIANT" sed -ri -e 's/^FROM .*/FROM '"$image"'/g' 'Dockerfile' docker build -t "$image-$dir" . - ~/official-images/test/run.sh "$image-$dir" ) fi done diff --git a/12.0/apache/entrypoint.sh b/12.0/apache/entrypoint.sh index 1f03c91..045227e 100755 --- a/12.0/apache/entrypoint.sh +++ b/12.0/apache/entrypoint.sh @@ -19,7 +19,7 @@ run_as() { fi } -if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then +if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then installed_version="0.0.0.0" if [ -f /var/www/html/version.php ]; then # shellcheck disable=SC2016 diff --git a/12.0/fpm-alpine/entrypoint.sh b/12.0/fpm-alpine/entrypoint.sh index 1f03c91..045227e 100755 --- a/12.0/fpm-alpine/entrypoint.sh +++ b/12.0/fpm-alpine/entrypoint.sh @@ -19,7 +19,7 @@ run_as() { fi } -if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then +if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then installed_version="0.0.0.0" if [ -f /var/www/html/version.php ]; then # shellcheck disable=SC2016 diff --git a/12.0/fpm/entrypoint.sh b/12.0/fpm/entrypoint.sh index 1f03c91..045227e 100755 --- a/12.0/fpm/entrypoint.sh +++ b/12.0/fpm/entrypoint.sh @@ -19,7 +19,7 @@ run_as() { fi } -if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then +if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then installed_version="0.0.0.0" if [ -f /var/www/html/version.php ]; then # shellcheck disable=SC2016 diff --git a/13.0/apache/entrypoint.sh b/13.0/apache/entrypoint.sh index 1f03c91..045227e 100755 --- a/13.0/apache/entrypoint.sh +++ b/13.0/apache/entrypoint.sh @@ -19,7 +19,7 @@ run_as() { fi } -if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then +if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then installed_version="0.0.0.0" if [ -f /var/www/html/version.php ]; then # shellcheck disable=SC2016 diff --git a/13.0/fpm-alpine/entrypoint.sh b/13.0/fpm-alpine/entrypoint.sh index 1f03c91..045227e 100755 --- a/13.0/fpm-alpine/entrypoint.sh +++ b/13.0/fpm-alpine/entrypoint.sh @@ -19,7 +19,7 @@ run_as() { fi } -if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then +if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then installed_version="0.0.0.0" if [ -f /var/www/html/version.php ]; then # shellcheck disable=SC2016 diff --git a/13.0/fpm/entrypoint.sh b/13.0/fpm/entrypoint.sh index 1f03c91..045227e 100755 --- a/13.0/fpm/entrypoint.sh +++ b/13.0/fpm/entrypoint.sh @@ -19,7 +19,7 @@ run_as() { fi } -if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then +if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then installed_version="0.0.0.0" if [ -f /var/www/html/version.php ]; then # shellcheck disable=SC2016 diff --git a/14.0/apache/entrypoint.sh b/14.0/apache/entrypoint.sh index 1f03c91..045227e 100755 --- a/14.0/apache/entrypoint.sh +++ b/14.0/apache/entrypoint.sh @@ -19,7 +19,7 @@ run_as() { fi } -if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then +if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then installed_version="0.0.0.0" if [ -f /var/www/html/version.php ]; then # shellcheck disable=SC2016 diff --git a/14.0/fpm-alpine/entrypoint.sh b/14.0/fpm-alpine/entrypoint.sh index 1f03c91..045227e 100755 --- a/14.0/fpm-alpine/entrypoint.sh +++ b/14.0/fpm-alpine/entrypoint.sh @@ -19,7 +19,7 @@ run_as() { fi } -if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then +if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then installed_version="0.0.0.0" if [ -f /var/www/html/version.php ]; then # shellcheck disable=SC2016 diff --git a/14.0/fpm/entrypoint.sh b/14.0/fpm/entrypoint.sh index 1f03c91..045227e 100755 --- a/14.0/fpm/entrypoint.sh +++ b/14.0/fpm/entrypoint.sh @@ -19,7 +19,7 @@ run_as() { fi } -if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then +if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then installed_version="0.0.0.0" if [ -f /var/www/html/version.php ]; then # shellcheck disable=SC2016 diff --git a/README.md b/README.md index 8640fab..0d712c0 100644 --- a/README.md +++ b/README.md @@ -126,6 +126,12 @@ One or more trusted domains can be set by environemnt variable, too. They will b - `NEXTCLOUD_TRUSTED_DOMAINS` (not set by default) Optional space-separated list of domains +The install and update script is only triggered when a default command is used (`apache-foreground` or `php-fpm`). If you use a custom command you have to enable the install / update with + +- `NEXTCLOUD_UPDATE` (default: _0_) + + + # Running this image with docker-compose The easiest way to get a fully featured and functional setup is using a `docker-compose` file. There are too many different possibilities to setup your system, so here are only some examples what you have to look for. @@ -276,6 +282,19 @@ If you use your own Dockerfile you need to configure your docker-compose file ac restart: always ``` +If you intend to use another command to run the image. Make sure that you set `NEXTCLOUD_UPDATE=1` in your Dockerfile. Otherwise the installation and update will not work. + +```yaml +FROM nextcloud:apache + +... + +ENV NEXTCLOUD_UPDATE=1 + +CMD ["/usr/bin/supervisord"] +``` + + **Updating** your own derived image is also very simple. When a new version of the Nextcloud image is available run: ```console diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 1f03c91..045227e 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -19,7 +19,7 @@ run_as() { fi } -if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then +if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then installed_version="0.0.0.0" if [ -f /var/www/html/version.php ]; then # shellcheck disable=SC2016