From 63710a75a346f5445f96d1daa0cd93248a9eaedb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Br=C3=BCckner?= Date: Sat, 13 Oct 2018 22:19:16 +0200 Subject: [PATCH 1/6] added new environment variable --- 12.0/apache/entrypoint.sh | 2 +- 12.0/fpm-alpine/entrypoint.sh | 2 +- 12.0/fpm/entrypoint.sh | 2 +- 13.0/apache/entrypoint.sh | 2 +- 13.0/fpm-alpine/entrypoint.sh | 2 +- 13.0/fpm/entrypoint.sh | 2 +- 14.0/apache/entrypoint.sh | 2 +- 14.0/fpm-alpine/entrypoint.sh | 2 +- 14.0/fpm/entrypoint.sh | 2 +- docker-entrypoint.sh | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/12.0/apache/entrypoint.sh b/12.0/apache/entrypoint.sh index c1c106c..c1c610d 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 c1c106c..c1c610d 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 c1c106c..c1c610d 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 c1c106c..c1c610d 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 c1c106c..c1c610d 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 c1c106c..c1c610d 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 c1c106c..c1c610d 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 c1c106c..c1c610d 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 c1c106c..c1c610d 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/docker-entrypoint.sh b/docker-entrypoint.sh index c1c106c..c1c610d 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 From 396cf35c972673d26fcd4a6aefd0c38d8eeb52a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Br=C3=BCckner?= Date: Mon, 15 Oct 2018 15:11:29 +0200 Subject: [PATCH 2/6] Added documentation to readme --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index e87f831..27d70fa 100644 --- a/README.md +++ b/README.md @@ -123,6 +123,12 @@ If you want you can set the data directory and table prefix, otherwise default v - `NEXTCLOUD_TABLE_PREFIX` (default: _""_) Optional prefix for the tables. Used to be `oc_` in the past +The auto 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 can reenable 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. From b8161a19a0242680102ef2d55e1f0edcf5b8a817 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Br=C3=BCckner?= Date: Mon, 15 Oct 2018 15:21:03 +0200 Subject: [PATCH 3/6] added description for cron supervisord example --- .examples/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.examples/README.md b/.examples/README.md index 4e46b4a..688cf53 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 enable auto install and update run images like this with an additional environment variable: `NEXTCLOUD_UPDATE=1`. See [here](https://github.com/nextcloud/docker/blob/master/README.md#auto-configuration-via-environment-variables) for more information. [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). From b25e1abe9c6c6981fb8f0944adcf567c508c3cb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Br=C3=BCckner?= Date: Tue, 16 Oct 2018 16:38:04 +0200 Subject: [PATCH 4/6] added variable to Dockerfiles of cron supervisord example --- .examples/dockerfiles/cron/apache/Dockerfile | 2 ++ .examples/dockerfiles/cron/fpm/Dockerfile | 2 ++ 2 files changed, 4 insertions(+) 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"] From f0624351359622bf658b7a56fb9875cab69caf8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Br=C3=BCckner?= Date: Tue, 16 Oct 2018 16:38:36 +0200 Subject: [PATCH 5/6] clarified use of variable --- .examples/README.md | 2 +- README.md | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.examples/README.md b/.examples/README.md index 688cf53..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). This image runs `supervisord`. To enable auto install and update run images like this with an additional environment variable: `NEXTCLOUD_UPDATE=1`. See [here](https://github.com/nextcloud/docker/blob/master/README.md#auto-configuration-via-environment-variables) for more information. +[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/README.md b/README.md index 27d70fa..8919b58 100644 --- a/README.md +++ b/README.md @@ -123,7 +123,7 @@ If you want you can set the data directory and table prefix, otherwise default v - `NEXTCLOUD_TABLE_PREFIX` (default: _""_) Optional prefix for the tables. Used to be `oc_` in the past -The auto 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 can reenable the install / update with +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_) @@ -279,6 +279,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 From b3df4606be6ad9f7114dfbbd0ae094a0d49872eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Br=C3=BCckner?= Date: Tue, 16 Oct 2018 17:43:56 +0200 Subject: [PATCH 6/6] remove official images test for example images --- .travis/test-example-dockerfiles.sh | 1 - 1 file changed, 1 deletion(-) 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