From 8f2bc6bec71b16833c4b6570a6c607aec63593b1 Mon Sep 17 00:00:00 2001 From: Tilo Spannagel Date: Mon, 17 Apr 2017 22:49:53 +0200 Subject: [PATCH 1/8] add version comparison --- 10.0/apache/docker-entrypoint.sh | 18 +++++++++++++++++- 10.0/fpm/docker-entrypoint.sh | 18 +++++++++++++++++- 11.0/apache/docker-entrypoint.sh | 18 +++++++++++++++++- 11.0/fpm/docker-entrypoint.sh | 18 +++++++++++++++++- 9.0/apache/docker-entrypoint.sh | 18 +++++++++++++++++- 9.0/fpm/docker-entrypoint.sh | 18 +++++++++++++++++- docker-entrypoint.sh | 18 +++++++++++++++++- 7 files changed, 119 insertions(+), 7 deletions(-) diff --git a/10.0/apache/docker-entrypoint.sh b/10.0/apache/docker-entrypoint.sh index 62d1625..3dc4a32 100755 --- a/10.0/apache/docker-entrypoint.sh +++ b/10.0/apache/docker-entrypoint.sh @@ -1,7 +1,23 @@ #!/bin/bash set -e -if [ ! -e '/var/www/html/version.php' ]; then +# version_greater A B returns whether A > B +function version_greater() { + [[ "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1" ]]; +} + +installed_version="0.0.0~unknown" +if [ -f /var/www/html/version.php ]; then + installed_version=$(php -r 'require "/var/www/html/version.php"; echo "$OC_VersionString";') +fi +image_version=$(php -r 'require "/usr/src/nextcloud/version.php"; echo "$OC_VersionString";') + +if version_greater "$installed_version" "$image_version"; then + echo "Downgrade not supported" + exit 1 +fi + +if version_greater "$image_version" "$installed_version"; then tar cf - --one-file-system -C /usr/src/nextcloud . | tar xf - chown -R www-data /var/www/html fi diff --git a/10.0/fpm/docker-entrypoint.sh b/10.0/fpm/docker-entrypoint.sh index 62d1625..3dc4a32 100755 --- a/10.0/fpm/docker-entrypoint.sh +++ b/10.0/fpm/docker-entrypoint.sh @@ -1,7 +1,23 @@ #!/bin/bash set -e -if [ ! -e '/var/www/html/version.php' ]; then +# version_greater A B returns whether A > B +function version_greater() { + [[ "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1" ]]; +} + +installed_version="0.0.0~unknown" +if [ -f /var/www/html/version.php ]; then + installed_version=$(php -r 'require "/var/www/html/version.php"; echo "$OC_VersionString";') +fi +image_version=$(php -r 'require "/usr/src/nextcloud/version.php"; echo "$OC_VersionString";') + +if version_greater "$installed_version" "$image_version"; then + echo "Downgrade not supported" + exit 1 +fi + +if version_greater "$image_version" "$installed_version"; then tar cf - --one-file-system -C /usr/src/nextcloud . | tar xf - chown -R www-data /var/www/html fi diff --git a/11.0/apache/docker-entrypoint.sh b/11.0/apache/docker-entrypoint.sh index 62d1625..3dc4a32 100755 --- a/11.0/apache/docker-entrypoint.sh +++ b/11.0/apache/docker-entrypoint.sh @@ -1,7 +1,23 @@ #!/bin/bash set -e -if [ ! -e '/var/www/html/version.php' ]; then +# version_greater A B returns whether A > B +function version_greater() { + [[ "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1" ]]; +} + +installed_version="0.0.0~unknown" +if [ -f /var/www/html/version.php ]; then + installed_version=$(php -r 'require "/var/www/html/version.php"; echo "$OC_VersionString";') +fi +image_version=$(php -r 'require "/usr/src/nextcloud/version.php"; echo "$OC_VersionString";') + +if version_greater "$installed_version" "$image_version"; then + echo "Downgrade not supported" + exit 1 +fi + +if version_greater "$image_version" "$installed_version"; then tar cf - --one-file-system -C /usr/src/nextcloud . | tar xf - chown -R www-data /var/www/html fi diff --git a/11.0/fpm/docker-entrypoint.sh b/11.0/fpm/docker-entrypoint.sh index 62d1625..3dc4a32 100755 --- a/11.0/fpm/docker-entrypoint.sh +++ b/11.0/fpm/docker-entrypoint.sh @@ -1,7 +1,23 @@ #!/bin/bash set -e -if [ ! -e '/var/www/html/version.php' ]; then +# version_greater A B returns whether A > B +function version_greater() { + [[ "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1" ]]; +} + +installed_version="0.0.0~unknown" +if [ -f /var/www/html/version.php ]; then + installed_version=$(php -r 'require "/var/www/html/version.php"; echo "$OC_VersionString";') +fi +image_version=$(php -r 'require "/usr/src/nextcloud/version.php"; echo "$OC_VersionString";') + +if version_greater "$installed_version" "$image_version"; then + echo "Downgrade not supported" + exit 1 +fi + +if version_greater "$image_version" "$installed_version"; then tar cf - --one-file-system -C /usr/src/nextcloud . | tar xf - chown -R www-data /var/www/html fi diff --git a/9.0/apache/docker-entrypoint.sh b/9.0/apache/docker-entrypoint.sh index 62d1625..3dc4a32 100755 --- a/9.0/apache/docker-entrypoint.sh +++ b/9.0/apache/docker-entrypoint.sh @@ -1,7 +1,23 @@ #!/bin/bash set -e -if [ ! -e '/var/www/html/version.php' ]; then +# version_greater A B returns whether A > B +function version_greater() { + [[ "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1" ]]; +} + +installed_version="0.0.0~unknown" +if [ -f /var/www/html/version.php ]; then + installed_version=$(php -r 'require "/var/www/html/version.php"; echo "$OC_VersionString";') +fi +image_version=$(php -r 'require "/usr/src/nextcloud/version.php"; echo "$OC_VersionString";') + +if version_greater "$installed_version" "$image_version"; then + echo "Downgrade not supported" + exit 1 +fi + +if version_greater "$image_version" "$installed_version"; then tar cf - --one-file-system -C /usr/src/nextcloud . | tar xf - chown -R www-data /var/www/html fi diff --git a/9.0/fpm/docker-entrypoint.sh b/9.0/fpm/docker-entrypoint.sh index 62d1625..3dc4a32 100755 --- a/9.0/fpm/docker-entrypoint.sh +++ b/9.0/fpm/docker-entrypoint.sh @@ -1,7 +1,23 @@ #!/bin/bash set -e -if [ ! -e '/var/www/html/version.php' ]; then +# version_greater A B returns whether A > B +function version_greater() { + [[ "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1" ]]; +} + +installed_version="0.0.0~unknown" +if [ -f /var/www/html/version.php ]; then + installed_version=$(php -r 'require "/var/www/html/version.php"; echo "$OC_VersionString";') +fi +image_version=$(php -r 'require "/usr/src/nextcloud/version.php"; echo "$OC_VersionString";') + +if version_greater "$installed_version" "$image_version"; then + echo "Downgrade not supported" + exit 1 +fi + +if version_greater "$image_version" "$installed_version"; then tar cf - --one-file-system -C /usr/src/nextcloud . | tar xf - chown -R www-data /var/www/html fi diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 62d1625..3dc4a32 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -1,7 +1,23 @@ #!/bin/bash set -e -if [ ! -e '/var/www/html/version.php' ]; then +# version_greater A B returns whether A > B +function version_greater() { + [[ "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1" ]]; +} + +installed_version="0.0.0~unknown" +if [ -f /var/www/html/version.php ]; then + installed_version=$(php -r 'require "/var/www/html/version.php"; echo "$OC_VersionString";') +fi +image_version=$(php -r 'require "/usr/src/nextcloud/version.php"; echo "$OC_VersionString";') + +if version_greater "$installed_version" "$image_version"; then + echo "Downgrade not supported" + exit 1 +fi + +if version_greater "$image_version" "$installed_version"; then tar cf - --one-file-system -C /usr/src/nextcloud . | tar xf - chown -R www-data /var/www/html fi From 055f5778e3f2bd3ca40fe8449f526dd97b94ccc9 Mon Sep 17 00:00:00 2001 From: Tilo Spannagel Date: Mon, 17 Apr 2017 22:53:39 +0200 Subject: [PATCH 2/8] use rsync for upgrade --- 10.0/apache/Dockerfile | 1 + 10.0/apache/docker-entrypoint.sh | 13 ++++++++++++- 10.0/fpm/Dockerfile | 1 + 10.0/fpm/docker-entrypoint.sh | 13 ++++++++++++- 11.0/apache/Dockerfile | 1 + 11.0/apache/docker-entrypoint.sh | 13 ++++++++++++- 11.0/fpm/Dockerfile | 1 + 11.0/fpm/docker-entrypoint.sh | 13 ++++++++++++- 9.0/apache/Dockerfile | 1 + 9.0/apache/docker-entrypoint.sh | 13 ++++++++++++- 9.0/fpm/Dockerfile | 1 + 9.0/fpm/docker-entrypoint.sh | 13 ++++++++++++- Dockerfile-php7.template | 1 + Dockerfile.template | 1 + docker-entrypoint.sh | 13 ++++++++++++- 15 files changed, 92 insertions(+), 7 deletions(-) diff --git a/10.0/apache/Dockerfile b/10.0/apache/Dockerfile index c7c580d..54e4801 100644 --- a/10.0/apache/Dockerfile +++ b/10.0/apache/Dockerfile @@ -1,6 +1,7 @@ FROM php:5.6-apache RUN apt-get update && apt-get install -y \ + rsync \ bzip2 \ libcurl4-openssl-dev \ libfreetype6-dev \ diff --git a/10.0/apache/docker-entrypoint.sh b/10.0/apache/docker-entrypoint.sh index 3dc4a32..01213c0 100755 --- a/10.0/apache/docker-entrypoint.sh +++ b/10.0/apache/docker-entrypoint.sh @@ -18,7 +18,18 @@ if version_greater "$installed_version" "$image_version"; then fi if version_greater "$image_version" "$installed_version"; then - tar cf - --one-file-system -C /usr/src/nextcloud . | tar xf - + rsync -a --delete --exclude /config/ --exclude /data/ --exclude /apps/ /usr/src/nextcloud/ /var/www/html/ + + if [ ! -d /var/www/html/config ]; then + cp -arT /usr/src/nextcloud/config /var/www/html/config + fi + + mkdir -p /var/www/html/apps + for app in `find /usr/src/nextcloud/apps -maxdepth 1 -mindepth 1 -type d | cut -d / -f 6`; do + rm -rf /var/www/html/apps/$app + cp -arT /usr/src/nextcloud/apps/$app /var/www/html/apps/$app + done + chown -R www-data /var/www/html fi diff --git a/10.0/fpm/Dockerfile b/10.0/fpm/Dockerfile index cdb7a34..5f4c7e2 100644 --- a/10.0/fpm/Dockerfile +++ b/10.0/fpm/Dockerfile @@ -1,6 +1,7 @@ FROM php:5.6-fpm RUN apt-get update && apt-get install -y \ + rsync \ bzip2 \ libcurl4-openssl-dev \ libfreetype6-dev \ diff --git a/10.0/fpm/docker-entrypoint.sh b/10.0/fpm/docker-entrypoint.sh index 3dc4a32..01213c0 100755 --- a/10.0/fpm/docker-entrypoint.sh +++ b/10.0/fpm/docker-entrypoint.sh @@ -18,7 +18,18 @@ if version_greater "$installed_version" "$image_version"; then fi if version_greater "$image_version" "$installed_version"; then - tar cf - --one-file-system -C /usr/src/nextcloud . | tar xf - + rsync -a --delete --exclude /config/ --exclude /data/ --exclude /apps/ /usr/src/nextcloud/ /var/www/html/ + + if [ ! -d /var/www/html/config ]; then + cp -arT /usr/src/nextcloud/config /var/www/html/config + fi + + mkdir -p /var/www/html/apps + for app in `find /usr/src/nextcloud/apps -maxdepth 1 -mindepth 1 -type d | cut -d / -f 6`; do + rm -rf /var/www/html/apps/$app + cp -arT /usr/src/nextcloud/apps/$app /var/www/html/apps/$app + done + chown -R www-data /var/www/html fi diff --git a/11.0/apache/Dockerfile b/11.0/apache/Dockerfile index e801a80..5217f2e 100644 --- a/11.0/apache/Dockerfile +++ b/11.0/apache/Dockerfile @@ -1,6 +1,7 @@ FROM php:7.1-apache RUN apt-get update && apt-get install -y \ + rsync \ bzip2 \ libcurl4-openssl-dev \ libfreetype6-dev \ diff --git a/11.0/apache/docker-entrypoint.sh b/11.0/apache/docker-entrypoint.sh index 3dc4a32..01213c0 100755 --- a/11.0/apache/docker-entrypoint.sh +++ b/11.0/apache/docker-entrypoint.sh @@ -18,7 +18,18 @@ if version_greater "$installed_version" "$image_version"; then fi if version_greater "$image_version" "$installed_version"; then - tar cf - --one-file-system -C /usr/src/nextcloud . | tar xf - + rsync -a --delete --exclude /config/ --exclude /data/ --exclude /apps/ /usr/src/nextcloud/ /var/www/html/ + + if [ ! -d /var/www/html/config ]; then + cp -arT /usr/src/nextcloud/config /var/www/html/config + fi + + mkdir -p /var/www/html/apps + for app in `find /usr/src/nextcloud/apps -maxdepth 1 -mindepth 1 -type d | cut -d / -f 6`; do + rm -rf /var/www/html/apps/$app + cp -arT /usr/src/nextcloud/apps/$app /var/www/html/apps/$app + done + chown -R www-data /var/www/html fi diff --git a/11.0/fpm/Dockerfile b/11.0/fpm/Dockerfile index ea6f93a..e703bcd 100644 --- a/11.0/fpm/Dockerfile +++ b/11.0/fpm/Dockerfile @@ -1,6 +1,7 @@ FROM php:7.1-fpm RUN apt-get update && apt-get install -y \ + rsync \ bzip2 \ libcurl4-openssl-dev \ libfreetype6-dev \ diff --git a/11.0/fpm/docker-entrypoint.sh b/11.0/fpm/docker-entrypoint.sh index 3dc4a32..01213c0 100755 --- a/11.0/fpm/docker-entrypoint.sh +++ b/11.0/fpm/docker-entrypoint.sh @@ -18,7 +18,18 @@ if version_greater "$installed_version" "$image_version"; then fi if version_greater "$image_version" "$installed_version"; then - tar cf - --one-file-system -C /usr/src/nextcloud . | tar xf - + rsync -a --delete --exclude /config/ --exclude /data/ --exclude /apps/ /usr/src/nextcloud/ /var/www/html/ + + if [ ! -d /var/www/html/config ]; then + cp -arT /usr/src/nextcloud/config /var/www/html/config + fi + + mkdir -p /var/www/html/apps + for app in `find /usr/src/nextcloud/apps -maxdepth 1 -mindepth 1 -type d | cut -d / -f 6`; do + rm -rf /var/www/html/apps/$app + cp -arT /usr/src/nextcloud/apps/$app /var/www/html/apps/$app + done + chown -R www-data /var/www/html fi diff --git a/9.0/apache/Dockerfile b/9.0/apache/Dockerfile index b5f7740..432d60b 100644 --- a/9.0/apache/Dockerfile +++ b/9.0/apache/Dockerfile @@ -1,6 +1,7 @@ FROM php:5.6-apache RUN apt-get update && apt-get install -y \ + rsync \ bzip2 \ libcurl4-openssl-dev \ libfreetype6-dev \ diff --git a/9.0/apache/docker-entrypoint.sh b/9.0/apache/docker-entrypoint.sh index 3dc4a32..01213c0 100755 --- a/9.0/apache/docker-entrypoint.sh +++ b/9.0/apache/docker-entrypoint.sh @@ -18,7 +18,18 @@ if version_greater "$installed_version" "$image_version"; then fi if version_greater "$image_version" "$installed_version"; then - tar cf - --one-file-system -C /usr/src/nextcloud . | tar xf - + rsync -a --delete --exclude /config/ --exclude /data/ --exclude /apps/ /usr/src/nextcloud/ /var/www/html/ + + if [ ! -d /var/www/html/config ]; then + cp -arT /usr/src/nextcloud/config /var/www/html/config + fi + + mkdir -p /var/www/html/apps + for app in `find /usr/src/nextcloud/apps -maxdepth 1 -mindepth 1 -type d | cut -d / -f 6`; do + rm -rf /var/www/html/apps/$app + cp -arT /usr/src/nextcloud/apps/$app /var/www/html/apps/$app + done + chown -R www-data /var/www/html fi diff --git a/9.0/fpm/Dockerfile b/9.0/fpm/Dockerfile index da3911d..2bab08c 100644 --- a/9.0/fpm/Dockerfile +++ b/9.0/fpm/Dockerfile @@ -1,6 +1,7 @@ FROM php:5.6-fpm RUN apt-get update && apt-get install -y \ + rsync \ bzip2 \ libcurl4-openssl-dev \ libfreetype6-dev \ diff --git a/9.0/fpm/docker-entrypoint.sh b/9.0/fpm/docker-entrypoint.sh index 3dc4a32..01213c0 100755 --- a/9.0/fpm/docker-entrypoint.sh +++ b/9.0/fpm/docker-entrypoint.sh @@ -18,7 +18,18 @@ if version_greater "$installed_version" "$image_version"; then fi if version_greater "$image_version" "$installed_version"; then - tar cf - --one-file-system -C /usr/src/nextcloud . | tar xf - + rsync -a --delete --exclude /config/ --exclude /data/ --exclude /apps/ /usr/src/nextcloud/ /var/www/html/ + + if [ ! -d /var/www/html/config ]; then + cp -arT /usr/src/nextcloud/config /var/www/html/config + fi + + mkdir -p /var/www/html/apps + for app in `find /usr/src/nextcloud/apps -maxdepth 1 -mindepth 1 -type d | cut -d / -f 6`; do + rm -rf /var/www/html/apps/$app + cp -arT /usr/src/nextcloud/apps/$app /var/www/html/apps/$app + done + chown -R www-data /var/www/html fi diff --git a/Dockerfile-php7.template b/Dockerfile-php7.template index 6dd989a..afc62ea 100644 --- a/Dockerfile-php7.template +++ b/Dockerfile-php7.template @@ -1,6 +1,7 @@ FROM php:7.1-%%VARIANT%% RUN apt-get update && apt-get install -y \ + rsync \ bzip2 \ libcurl4-openssl-dev \ libfreetype6-dev \ diff --git a/Dockerfile.template b/Dockerfile.template index 3d71379..e03e8f1 100644 --- a/Dockerfile.template +++ b/Dockerfile.template @@ -1,6 +1,7 @@ FROM php:5.6-%%VARIANT%% RUN apt-get update && apt-get install -y \ + rsync \ bzip2 \ libcurl4-openssl-dev \ libfreetype6-dev \ diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 3dc4a32..01213c0 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -18,7 +18,18 @@ if version_greater "$installed_version" "$image_version"; then fi if version_greater "$image_version" "$installed_version"; then - tar cf - --one-file-system -C /usr/src/nextcloud . | tar xf - + rsync -a --delete --exclude /config/ --exclude /data/ --exclude /apps/ /usr/src/nextcloud/ /var/www/html/ + + if [ ! -d /var/www/html/config ]; then + cp -arT /usr/src/nextcloud/config /var/www/html/config + fi + + mkdir -p /var/www/html/apps + for app in `find /usr/src/nextcloud/apps -maxdepth 1 -mindepth 1 -type d | cut -d / -f 6`; do + rm -rf /var/www/html/apps/$app + cp -arT /usr/src/nextcloud/apps/$app /var/www/html/apps/$app + done + chown -R www-data /var/www/html fi From 87c651374ebed8fd4031f215607f56a909114b93 Mon Sep 17 00:00:00 2001 From: Tilo Spannagel Date: Mon, 17 Apr 2017 22:57:48 +0200 Subject: [PATCH 3/8] run occ upgrade --- 10.0/apache/docker-entrypoint.sh | 4 ++++ 10.0/fpm/docker-entrypoint.sh | 4 ++++ 11.0/apache/docker-entrypoint.sh | 4 ++++ 11.0/fpm/docker-entrypoint.sh | 4 ++++ 9.0/apache/docker-entrypoint.sh | 4 ++++ 9.0/fpm/docker-entrypoint.sh | 4 ++++ docker-entrypoint.sh | 4 ++++ 7 files changed, 28 insertions(+) diff --git a/10.0/apache/docker-entrypoint.sh b/10.0/apache/docker-entrypoint.sh index 01213c0..44bc1c0 100755 --- a/10.0/apache/docker-entrypoint.sh +++ b/10.0/apache/docker-entrypoint.sh @@ -31,6 +31,10 @@ if version_greater "$image_version" "$installed_version"; then done chown -R www-data /var/www/html + + if [ "$installed_version" != "0.0.0~unknown" ]; then + su - www-data -s /bin/bash -c 'php /var/www/html/occ upgrade --no-app-disable' + fi fi exec "$@" diff --git a/10.0/fpm/docker-entrypoint.sh b/10.0/fpm/docker-entrypoint.sh index 01213c0..44bc1c0 100755 --- a/10.0/fpm/docker-entrypoint.sh +++ b/10.0/fpm/docker-entrypoint.sh @@ -31,6 +31,10 @@ if version_greater "$image_version" "$installed_version"; then done chown -R www-data /var/www/html + + if [ "$installed_version" != "0.0.0~unknown" ]; then + su - www-data -s /bin/bash -c 'php /var/www/html/occ upgrade --no-app-disable' + fi fi exec "$@" diff --git a/11.0/apache/docker-entrypoint.sh b/11.0/apache/docker-entrypoint.sh index 01213c0..44bc1c0 100755 --- a/11.0/apache/docker-entrypoint.sh +++ b/11.0/apache/docker-entrypoint.sh @@ -31,6 +31,10 @@ if version_greater "$image_version" "$installed_version"; then done chown -R www-data /var/www/html + + if [ "$installed_version" != "0.0.0~unknown" ]; then + su - www-data -s /bin/bash -c 'php /var/www/html/occ upgrade --no-app-disable' + fi fi exec "$@" diff --git a/11.0/fpm/docker-entrypoint.sh b/11.0/fpm/docker-entrypoint.sh index 01213c0..44bc1c0 100755 --- a/11.0/fpm/docker-entrypoint.sh +++ b/11.0/fpm/docker-entrypoint.sh @@ -31,6 +31,10 @@ if version_greater "$image_version" "$installed_version"; then done chown -R www-data /var/www/html + + if [ "$installed_version" != "0.0.0~unknown" ]; then + su - www-data -s /bin/bash -c 'php /var/www/html/occ upgrade --no-app-disable' + fi fi exec "$@" diff --git a/9.0/apache/docker-entrypoint.sh b/9.0/apache/docker-entrypoint.sh index 01213c0..44bc1c0 100755 --- a/9.0/apache/docker-entrypoint.sh +++ b/9.0/apache/docker-entrypoint.sh @@ -31,6 +31,10 @@ if version_greater "$image_version" "$installed_version"; then done chown -R www-data /var/www/html + + if [ "$installed_version" != "0.0.0~unknown" ]; then + su - www-data -s /bin/bash -c 'php /var/www/html/occ upgrade --no-app-disable' + fi fi exec "$@" diff --git a/9.0/fpm/docker-entrypoint.sh b/9.0/fpm/docker-entrypoint.sh index 01213c0..44bc1c0 100755 --- a/9.0/fpm/docker-entrypoint.sh +++ b/9.0/fpm/docker-entrypoint.sh @@ -31,6 +31,10 @@ if version_greater "$image_version" "$installed_version"; then done chown -R www-data /var/www/html + + if [ "$installed_version" != "0.0.0~unknown" ]; then + su - www-data -s /bin/bash -c 'php /var/www/html/occ upgrade --no-app-disable' + fi fi exec "$@" diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 01213c0..44bc1c0 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -31,6 +31,10 @@ if version_greater "$image_version" "$installed_version"; then done chown -R www-data /var/www/html + + if [ "$installed_version" != "0.0.0~unknown" ]; then + su - www-data -s /bin/bash -c 'php /var/www/html/occ upgrade --no-app-disable' + fi fi exec "$@" From ae5b15cca3282261bd39f97750e1ccbb57ff673b Mon Sep 17 00:00:00 2001 From: Tilo Spannagel Date: Mon, 17 Apr 2017 23:00:56 +0200 Subject: [PATCH 4/8] show disabled apps --- 10.0/apache/docker-entrypoint.sh | 9 +++++++++ 10.0/fpm/docker-entrypoint.sh | 9 +++++++++ 11.0/apache/docker-entrypoint.sh | 9 +++++++++ 11.0/fpm/docker-entrypoint.sh | 9 +++++++++ 9.0/apache/docker-entrypoint.sh | 9 +++++++++ 9.0/fpm/docker-entrypoint.sh | 9 +++++++++ docker-entrypoint.sh | 9 +++++++++ 7 files changed, 63 insertions(+) diff --git a/10.0/apache/docker-entrypoint.sh b/10.0/apache/docker-entrypoint.sh index 44bc1c0..d747ead 100755 --- a/10.0/apache/docker-entrypoint.sh +++ b/10.0/apache/docker-entrypoint.sh @@ -18,6 +18,10 @@ if version_greater "$installed_version" "$image_version"; then fi if version_greater "$image_version" "$installed_version"; then + if [ "$installed_version" != "0.0.0~unknown" ]; then + su - www-data -s /bin/bash -c 'php /var/www/html/occ app:list' > /tmp/list_before + fi + rsync -a --delete --exclude /config/ --exclude /data/ --exclude /apps/ /usr/src/nextcloud/ /var/www/html/ if [ ! -d /var/www/html/config ]; then @@ -34,6 +38,11 @@ if version_greater "$image_version" "$installed_version"; then if [ "$installed_version" != "0.0.0~unknown" ]; then su - www-data -s /bin/bash -c 'php /var/www/html/occ upgrade --no-app-disable' + + su - www-data -s /bin/bash -c 'php /var/www/html/occ app:list' > /tmp/list_after + echo "The following apps have beed disabled:" + diff <(sed -n "/Enabled:/,/Disabled:/p" /tmp/list_before) <(sed -n "/Enabled:/,/Disabled:/p" /tmp/list_after) | grep '<' | cut -d- -f2 | cut -d: -f1 + rm -f /tmp/list_before /tmp/list_after fi fi diff --git a/10.0/fpm/docker-entrypoint.sh b/10.0/fpm/docker-entrypoint.sh index 44bc1c0..d747ead 100755 --- a/10.0/fpm/docker-entrypoint.sh +++ b/10.0/fpm/docker-entrypoint.sh @@ -18,6 +18,10 @@ if version_greater "$installed_version" "$image_version"; then fi if version_greater "$image_version" "$installed_version"; then + if [ "$installed_version" != "0.0.0~unknown" ]; then + su - www-data -s /bin/bash -c 'php /var/www/html/occ app:list' > /tmp/list_before + fi + rsync -a --delete --exclude /config/ --exclude /data/ --exclude /apps/ /usr/src/nextcloud/ /var/www/html/ if [ ! -d /var/www/html/config ]; then @@ -34,6 +38,11 @@ if version_greater "$image_version" "$installed_version"; then if [ "$installed_version" != "0.0.0~unknown" ]; then su - www-data -s /bin/bash -c 'php /var/www/html/occ upgrade --no-app-disable' + + su - www-data -s /bin/bash -c 'php /var/www/html/occ app:list' > /tmp/list_after + echo "The following apps have beed disabled:" + diff <(sed -n "/Enabled:/,/Disabled:/p" /tmp/list_before) <(sed -n "/Enabled:/,/Disabled:/p" /tmp/list_after) | grep '<' | cut -d- -f2 | cut -d: -f1 + rm -f /tmp/list_before /tmp/list_after fi fi diff --git a/11.0/apache/docker-entrypoint.sh b/11.0/apache/docker-entrypoint.sh index 44bc1c0..d747ead 100755 --- a/11.0/apache/docker-entrypoint.sh +++ b/11.0/apache/docker-entrypoint.sh @@ -18,6 +18,10 @@ if version_greater "$installed_version" "$image_version"; then fi if version_greater "$image_version" "$installed_version"; then + if [ "$installed_version" != "0.0.0~unknown" ]; then + su - www-data -s /bin/bash -c 'php /var/www/html/occ app:list' > /tmp/list_before + fi + rsync -a --delete --exclude /config/ --exclude /data/ --exclude /apps/ /usr/src/nextcloud/ /var/www/html/ if [ ! -d /var/www/html/config ]; then @@ -34,6 +38,11 @@ if version_greater "$image_version" "$installed_version"; then if [ "$installed_version" != "0.0.0~unknown" ]; then su - www-data -s /bin/bash -c 'php /var/www/html/occ upgrade --no-app-disable' + + su - www-data -s /bin/bash -c 'php /var/www/html/occ app:list' > /tmp/list_after + echo "The following apps have beed disabled:" + diff <(sed -n "/Enabled:/,/Disabled:/p" /tmp/list_before) <(sed -n "/Enabled:/,/Disabled:/p" /tmp/list_after) | grep '<' | cut -d- -f2 | cut -d: -f1 + rm -f /tmp/list_before /tmp/list_after fi fi diff --git a/11.0/fpm/docker-entrypoint.sh b/11.0/fpm/docker-entrypoint.sh index 44bc1c0..d747ead 100755 --- a/11.0/fpm/docker-entrypoint.sh +++ b/11.0/fpm/docker-entrypoint.sh @@ -18,6 +18,10 @@ if version_greater "$installed_version" "$image_version"; then fi if version_greater "$image_version" "$installed_version"; then + if [ "$installed_version" != "0.0.0~unknown" ]; then + su - www-data -s /bin/bash -c 'php /var/www/html/occ app:list' > /tmp/list_before + fi + rsync -a --delete --exclude /config/ --exclude /data/ --exclude /apps/ /usr/src/nextcloud/ /var/www/html/ if [ ! -d /var/www/html/config ]; then @@ -34,6 +38,11 @@ if version_greater "$image_version" "$installed_version"; then if [ "$installed_version" != "0.0.0~unknown" ]; then su - www-data -s /bin/bash -c 'php /var/www/html/occ upgrade --no-app-disable' + + su - www-data -s /bin/bash -c 'php /var/www/html/occ app:list' > /tmp/list_after + echo "The following apps have beed disabled:" + diff <(sed -n "/Enabled:/,/Disabled:/p" /tmp/list_before) <(sed -n "/Enabled:/,/Disabled:/p" /tmp/list_after) | grep '<' | cut -d- -f2 | cut -d: -f1 + rm -f /tmp/list_before /tmp/list_after fi fi diff --git a/9.0/apache/docker-entrypoint.sh b/9.0/apache/docker-entrypoint.sh index 44bc1c0..d747ead 100755 --- a/9.0/apache/docker-entrypoint.sh +++ b/9.0/apache/docker-entrypoint.sh @@ -18,6 +18,10 @@ if version_greater "$installed_version" "$image_version"; then fi if version_greater "$image_version" "$installed_version"; then + if [ "$installed_version" != "0.0.0~unknown" ]; then + su - www-data -s /bin/bash -c 'php /var/www/html/occ app:list' > /tmp/list_before + fi + rsync -a --delete --exclude /config/ --exclude /data/ --exclude /apps/ /usr/src/nextcloud/ /var/www/html/ if [ ! -d /var/www/html/config ]; then @@ -34,6 +38,11 @@ if version_greater "$image_version" "$installed_version"; then if [ "$installed_version" != "0.0.0~unknown" ]; then su - www-data -s /bin/bash -c 'php /var/www/html/occ upgrade --no-app-disable' + + su - www-data -s /bin/bash -c 'php /var/www/html/occ app:list' > /tmp/list_after + echo "The following apps have beed disabled:" + diff <(sed -n "/Enabled:/,/Disabled:/p" /tmp/list_before) <(sed -n "/Enabled:/,/Disabled:/p" /tmp/list_after) | grep '<' | cut -d- -f2 | cut -d: -f1 + rm -f /tmp/list_before /tmp/list_after fi fi diff --git a/9.0/fpm/docker-entrypoint.sh b/9.0/fpm/docker-entrypoint.sh index 44bc1c0..d747ead 100755 --- a/9.0/fpm/docker-entrypoint.sh +++ b/9.0/fpm/docker-entrypoint.sh @@ -18,6 +18,10 @@ if version_greater "$installed_version" "$image_version"; then fi if version_greater "$image_version" "$installed_version"; then + if [ "$installed_version" != "0.0.0~unknown" ]; then + su - www-data -s /bin/bash -c 'php /var/www/html/occ app:list' > /tmp/list_before + fi + rsync -a --delete --exclude /config/ --exclude /data/ --exclude /apps/ /usr/src/nextcloud/ /var/www/html/ if [ ! -d /var/www/html/config ]; then @@ -34,6 +38,11 @@ if version_greater "$image_version" "$installed_version"; then if [ "$installed_version" != "0.0.0~unknown" ]; then su - www-data -s /bin/bash -c 'php /var/www/html/occ upgrade --no-app-disable' + + su - www-data -s /bin/bash -c 'php /var/www/html/occ app:list' > /tmp/list_after + echo "The following apps have beed disabled:" + diff <(sed -n "/Enabled:/,/Disabled:/p" /tmp/list_before) <(sed -n "/Enabled:/,/Disabled:/p" /tmp/list_after) | grep '<' | cut -d- -f2 | cut -d: -f1 + rm -f /tmp/list_before /tmp/list_after fi fi diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 44bc1c0..d747ead 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -18,6 +18,10 @@ if version_greater "$installed_version" "$image_version"; then fi if version_greater "$image_version" "$installed_version"; then + if [ "$installed_version" != "0.0.0~unknown" ]; then + su - www-data -s /bin/bash -c 'php /var/www/html/occ app:list' > /tmp/list_before + fi + rsync -a --delete --exclude /config/ --exclude /data/ --exclude /apps/ /usr/src/nextcloud/ /var/www/html/ if [ ! -d /var/www/html/config ]; then @@ -34,6 +38,11 @@ if version_greater "$image_version" "$installed_version"; then if [ "$installed_version" != "0.0.0~unknown" ]; then su - www-data -s /bin/bash -c 'php /var/www/html/occ upgrade --no-app-disable' + + su - www-data -s /bin/bash -c 'php /var/www/html/occ app:list' > /tmp/list_after + echo "The following apps have beed disabled:" + diff <(sed -n "/Enabled:/,/Disabled:/p" /tmp/list_before) <(sed -n "/Enabled:/,/Disabled:/p" /tmp/list_after) | grep '<' | cut -d- -f2 | cut -d: -f1 + rm -f /tmp/list_before /tmp/list_after fi fi From fc384e6a7e4a7df0fd4a5275f4634ef220d0855a Mon Sep 17 00:00:00 2001 From: Tilo Spannagel Date: Mon, 17 Apr 2017 23:02:25 +0200 Subject: [PATCH 5/8] split app folder --- 10.0/apache/Dockerfile | 1 + 10.0/apache/apps.config.php | 15 +++++++++++++++ 10.0/apache/docker-entrypoint.sh | 8 ++------ 10.0/fpm/Dockerfile | 1 + 10.0/fpm/apps.config.php | 15 +++++++++++++++ 10.0/fpm/docker-entrypoint.sh | 8 ++------ 11.0/apache/Dockerfile | 1 + 11.0/apache/apps.config.php | 15 +++++++++++++++ 11.0/apache/docker-entrypoint.sh | 8 ++------ 11.0/fpm/Dockerfile | 1 + 11.0/fpm/apps.config.php | 15 +++++++++++++++ 11.0/fpm/docker-entrypoint.sh | 8 ++------ 9.0/apache/Dockerfile | 1 + 9.0/apache/apps.config.php | 15 +++++++++++++++ 9.0/apache/docker-entrypoint.sh | 8 ++------ 9.0/fpm/Dockerfile | 1 + 9.0/fpm/apps.config.php | 15 +++++++++++++++ 9.0/fpm/docker-entrypoint.sh | 8 ++------ Dockerfile-php7.template | 1 + Dockerfile.template | 1 + apps.config.php | 15 +++++++++++++++ docker-entrypoint.sh | 8 ++------ update.sh | 3 +++ 23 files changed, 130 insertions(+), 42 deletions(-) create mode 100644 10.0/apache/apps.config.php create mode 100644 10.0/fpm/apps.config.php create mode 100644 11.0/apache/apps.config.php create mode 100644 11.0/fpm/apps.config.php create mode 100644 9.0/apache/apps.config.php create mode 100644 9.0/fpm/apps.config.php create mode 100644 apps.config.php diff --git a/10.0/apache/Dockerfile b/10.0/apache/Dockerfile index 54e4801..1a51103 100644 --- a/10.0/apache/Dockerfile +++ b/10.0/apache/Dockerfile @@ -56,6 +56,7 @@ RUN curl -fsSL -o nextcloud.tar.bz2 \ && rm nextcloud.tar.bz2 COPY docker-entrypoint.sh /entrypoint.sh +COPY apps.config.php /usr/src/nextcloud/config/apps.config.php ENTRYPOINT ["/entrypoint.sh"] CMD ["apache2-foreground"] diff --git a/10.0/apache/apps.config.php b/10.0/apache/apps.config.php new file mode 100644 index 0000000..a4bed83 --- /dev/null +++ b/10.0/apache/apps.config.php @@ -0,0 +1,15 @@ + array ( + 0 => array ( + "path" => OC::$SERVERROOT."/apps", + "url" => "/apps", + "writable" => false, + ), + 1 => array ( + "path" => OC::$SERVERROOT."/custom_apps", + "url" => "/custom_apps", + "writable" => true, + ), + ), +); diff --git a/10.0/apache/docker-entrypoint.sh b/10.0/apache/docker-entrypoint.sh index d747ead..1d40304 100755 --- a/10.0/apache/docker-entrypoint.sh +++ b/10.0/apache/docker-entrypoint.sh @@ -22,17 +22,13 @@ if version_greater "$image_version" "$installed_version"; then su - www-data -s /bin/bash -c 'php /var/www/html/occ app:list' > /tmp/list_before fi - rsync -a --delete --exclude /config/ --exclude /data/ --exclude /apps/ /usr/src/nextcloud/ /var/www/html/ + rsync -a --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ /usr/src/nextcloud/ /var/www/html/ if [ ! -d /var/www/html/config ]; then cp -arT /usr/src/nextcloud/config /var/www/html/config fi - mkdir -p /var/www/html/apps - for app in `find /usr/src/nextcloud/apps -maxdepth 1 -mindepth 1 -type d | cut -d / -f 6`; do - rm -rf /var/www/html/apps/$app - cp -arT /usr/src/nextcloud/apps/$app /var/www/html/apps/$app - done + mkdir -p /var/www/html/custom_apps chown -R www-data /var/www/html diff --git a/10.0/fpm/Dockerfile b/10.0/fpm/Dockerfile index 5f4c7e2..6e01430 100644 --- a/10.0/fpm/Dockerfile +++ b/10.0/fpm/Dockerfile @@ -54,6 +54,7 @@ RUN curl -fsSL -o nextcloud.tar.bz2 \ && rm nextcloud.tar.bz2 COPY docker-entrypoint.sh /entrypoint.sh +COPY apps.config.php /usr/src/nextcloud/config/apps.config.php ENTRYPOINT ["/entrypoint.sh"] CMD ["php-fpm"] diff --git a/10.0/fpm/apps.config.php b/10.0/fpm/apps.config.php new file mode 100644 index 0000000..a4bed83 --- /dev/null +++ b/10.0/fpm/apps.config.php @@ -0,0 +1,15 @@ + array ( + 0 => array ( + "path" => OC::$SERVERROOT."/apps", + "url" => "/apps", + "writable" => false, + ), + 1 => array ( + "path" => OC::$SERVERROOT."/custom_apps", + "url" => "/custom_apps", + "writable" => true, + ), + ), +); diff --git a/10.0/fpm/docker-entrypoint.sh b/10.0/fpm/docker-entrypoint.sh index d747ead..1d40304 100755 --- a/10.0/fpm/docker-entrypoint.sh +++ b/10.0/fpm/docker-entrypoint.sh @@ -22,17 +22,13 @@ if version_greater "$image_version" "$installed_version"; then su - www-data -s /bin/bash -c 'php /var/www/html/occ app:list' > /tmp/list_before fi - rsync -a --delete --exclude /config/ --exclude /data/ --exclude /apps/ /usr/src/nextcloud/ /var/www/html/ + rsync -a --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ /usr/src/nextcloud/ /var/www/html/ if [ ! -d /var/www/html/config ]; then cp -arT /usr/src/nextcloud/config /var/www/html/config fi - mkdir -p /var/www/html/apps - for app in `find /usr/src/nextcloud/apps -maxdepth 1 -mindepth 1 -type d | cut -d / -f 6`; do - rm -rf /var/www/html/apps/$app - cp -arT /usr/src/nextcloud/apps/$app /var/www/html/apps/$app - done + mkdir -p /var/www/html/custom_apps chown -R www-data /var/www/html diff --git a/11.0/apache/Dockerfile b/11.0/apache/Dockerfile index 5217f2e..8fe705f 100644 --- a/11.0/apache/Dockerfile +++ b/11.0/apache/Dockerfile @@ -56,6 +56,7 @@ RUN curl -fsSL -o nextcloud.tar.bz2 \ && rm nextcloud.tar.bz2 COPY docker-entrypoint.sh /entrypoint.sh +COPY apps.config.php /usr/src/nextcloud/config/apps.config.php ENTRYPOINT ["/entrypoint.sh"] CMD ["apache2-foreground"] diff --git a/11.0/apache/apps.config.php b/11.0/apache/apps.config.php new file mode 100644 index 0000000..a4bed83 --- /dev/null +++ b/11.0/apache/apps.config.php @@ -0,0 +1,15 @@ + array ( + 0 => array ( + "path" => OC::$SERVERROOT."/apps", + "url" => "/apps", + "writable" => false, + ), + 1 => array ( + "path" => OC::$SERVERROOT."/custom_apps", + "url" => "/custom_apps", + "writable" => true, + ), + ), +); diff --git a/11.0/apache/docker-entrypoint.sh b/11.0/apache/docker-entrypoint.sh index d747ead..1d40304 100755 --- a/11.0/apache/docker-entrypoint.sh +++ b/11.0/apache/docker-entrypoint.sh @@ -22,17 +22,13 @@ if version_greater "$image_version" "$installed_version"; then su - www-data -s /bin/bash -c 'php /var/www/html/occ app:list' > /tmp/list_before fi - rsync -a --delete --exclude /config/ --exclude /data/ --exclude /apps/ /usr/src/nextcloud/ /var/www/html/ + rsync -a --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ /usr/src/nextcloud/ /var/www/html/ if [ ! -d /var/www/html/config ]; then cp -arT /usr/src/nextcloud/config /var/www/html/config fi - mkdir -p /var/www/html/apps - for app in `find /usr/src/nextcloud/apps -maxdepth 1 -mindepth 1 -type d | cut -d / -f 6`; do - rm -rf /var/www/html/apps/$app - cp -arT /usr/src/nextcloud/apps/$app /var/www/html/apps/$app - done + mkdir -p /var/www/html/custom_apps chown -R www-data /var/www/html diff --git a/11.0/fpm/Dockerfile b/11.0/fpm/Dockerfile index e703bcd..c77129a 100644 --- a/11.0/fpm/Dockerfile +++ b/11.0/fpm/Dockerfile @@ -54,6 +54,7 @@ RUN curl -fsSL -o nextcloud.tar.bz2 \ && rm nextcloud.tar.bz2 COPY docker-entrypoint.sh /entrypoint.sh +COPY apps.config.php /usr/src/nextcloud/config/apps.config.php ENTRYPOINT ["/entrypoint.sh"] CMD ["php-fpm"] diff --git a/11.0/fpm/apps.config.php b/11.0/fpm/apps.config.php new file mode 100644 index 0000000..a4bed83 --- /dev/null +++ b/11.0/fpm/apps.config.php @@ -0,0 +1,15 @@ + array ( + 0 => array ( + "path" => OC::$SERVERROOT."/apps", + "url" => "/apps", + "writable" => false, + ), + 1 => array ( + "path" => OC::$SERVERROOT."/custom_apps", + "url" => "/custom_apps", + "writable" => true, + ), + ), +); diff --git a/11.0/fpm/docker-entrypoint.sh b/11.0/fpm/docker-entrypoint.sh index d747ead..1d40304 100755 --- a/11.0/fpm/docker-entrypoint.sh +++ b/11.0/fpm/docker-entrypoint.sh @@ -22,17 +22,13 @@ if version_greater "$image_version" "$installed_version"; then su - www-data -s /bin/bash -c 'php /var/www/html/occ app:list' > /tmp/list_before fi - rsync -a --delete --exclude /config/ --exclude /data/ --exclude /apps/ /usr/src/nextcloud/ /var/www/html/ + rsync -a --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ /usr/src/nextcloud/ /var/www/html/ if [ ! -d /var/www/html/config ]; then cp -arT /usr/src/nextcloud/config /var/www/html/config fi - mkdir -p /var/www/html/apps - for app in `find /usr/src/nextcloud/apps -maxdepth 1 -mindepth 1 -type d | cut -d / -f 6`; do - rm -rf /var/www/html/apps/$app - cp -arT /usr/src/nextcloud/apps/$app /var/www/html/apps/$app - done + mkdir -p /var/www/html/custom_apps chown -R www-data /var/www/html diff --git a/9.0/apache/Dockerfile b/9.0/apache/Dockerfile index 432d60b..d9bb364 100644 --- a/9.0/apache/Dockerfile +++ b/9.0/apache/Dockerfile @@ -56,6 +56,7 @@ RUN curl -fsSL -o nextcloud.tar.bz2 \ && rm nextcloud.tar.bz2 COPY docker-entrypoint.sh /entrypoint.sh +COPY apps.config.php /usr/src/nextcloud/config/apps.config.php ENTRYPOINT ["/entrypoint.sh"] CMD ["apache2-foreground"] diff --git a/9.0/apache/apps.config.php b/9.0/apache/apps.config.php new file mode 100644 index 0000000..a4bed83 --- /dev/null +++ b/9.0/apache/apps.config.php @@ -0,0 +1,15 @@ + array ( + 0 => array ( + "path" => OC::$SERVERROOT."/apps", + "url" => "/apps", + "writable" => false, + ), + 1 => array ( + "path" => OC::$SERVERROOT."/custom_apps", + "url" => "/custom_apps", + "writable" => true, + ), + ), +); diff --git a/9.0/apache/docker-entrypoint.sh b/9.0/apache/docker-entrypoint.sh index d747ead..1d40304 100755 --- a/9.0/apache/docker-entrypoint.sh +++ b/9.0/apache/docker-entrypoint.sh @@ -22,17 +22,13 @@ if version_greater "$image_version" "$installed_version"; then su - www-data -s /bin/bash -c 'php /var/www/html/occ app:list' > /tmp/list_before fi - rsync -a --delete --exclude /config/ --exclude /data/ --exclude /apps/ /usr/src/nextcloud/ /var/www/html/ + rsync -a --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ /usr/src/nextcloud/ /var/www/html/ if [ ! -d /var/www/html/config ]; then cp -arT /usr/src/nextcloud/config /var/www/html/config fi - mkdir -p /var/www/html/apps - for app in `find /usr/src/nextcloud/apps -maxdepth 1 -mindepth 1 -type d | cut -d / -f 6`; do - rm -rf /var/www/html/apps/$app - cp -arT /usr/src/nextcloud/apps/$app /var/www/html/apps/$app - done + mkdir -p /var/www/html/custom_apps chown -R www-data /var/www/html diff --git a/9.0/fpm/Dockerfile b/9.0/fpm/Dockerfile index 2bab08c..2b60039 100644 --- a/9.0/fpm/Dockerfile +++ b/9.0/fpm/Dockerfile @@ -54,6 +54,7 @@ RUN curl -fsSL -o nextcloud.tar.bz2 \ && rm nextcloud.tar.bz2 COPY docker-entrypoint.sh /entrypoint.sh +COPY apps.config.php /usr/src/nextcloud/config/apps.config.php ENTRYPOINT ["/entrypoint.sh"] CMD ["php-fpm"] diff --git a/9.0/fpm/apps.config.php b/9.0/fpm/apps.config.php new file mode 100644 index 0000000..a4bed83 --- /dev/null +++ b/9.0/fpm/apps.config.php @@ -0,0 +1,15 @@ + array ( + 0 => array ( + "path" => OC::$SERVERROOT."/apps", + "url" => "/apps", + "writable" => false, + ), + 1 => array ( + "path" => OC::$SERVERROOT."/custom_apps", + "url" => "/custom_apps", + "writable" => true, + ), + ), +); diff --git a/9.0/fpm/docker-entrypoint.sh b/9.0/fpm/docker-entrypoint.sh index d747ead..1d40304 100755 --- a/9.0/fpm/docker-entrypoint.sh +++ b/9.0/fpm/docker-entrypoint.sh @@ -22,17 +22,13 @@ if version_greater "$image_version" "$installed_version"; then su - www-data -s /bin/bash -c 'php /var/www/html/occ app:list' > /tmp/list_before fi - rsync -a --delete --exclude /config/ --exclude /data/ --exclude /apps/ /usr/src/nextcloud/ /var/www/html/ + rsync -a --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ /usr/src/nextcloud/ /var/www/html/ if [ ! -d /var/www/html/config ]; then cp -arT /usr/src/nextcloud/config /var/www/html/config fi - mkdir -p /var/www/html/apps - for app in `find /usr/src/nextcloud/apps -maxdepth 1 -mindepth 1 -type d | cut -d / -f 6`; do - rm -rf /var/www/html/apps/$app - cp -arT /usr/src/nextcloud/apps/$app /var/www/html/apps/$app - done + mkdir -p /var/www/html/custom_apps chown -R www-data /var/www/html diff --git a/Dockerfile-php7.template b/Dockerfile-php7.template index afc62ea..fe282ad 100644 --- a/Dockerfile-php7.template +++ b/Dockerfile-php7.template @@ -56,6 +56,7 @@ RUN curl -fsSL -o nextcloud.tar.bz2 \ && rm nextcloud.tar.bz2 COPY docker-entrypoint.sh /entrypoint.sh +COPY apps.config.php /usr/src/nextcloud/config/apps.config.php ENTRYPOINT ["/entrypoint.sh"] CMD ["%%CMD%%"] diff --git a/Dockerfile.template b/Dockerfile.template index e03e8f1..abfa9bc 100644 --- a/Dockerfile.template +++ b/Dockerfile.template @@ -56,6 +56,7 @@ RUN curl -fsSL -o nextcloud.tar.bz2 \ && rm nextcloud.tar.bz2 COPY docker-entrypoint.sh /entrypoint.sh +COPY apps.config.php /usr/src/nextcloud/config/apps.config.php ENTRYPOINT ["/entrypoint.sh"] CMD ["%%CMD%%"] diff --git a/apps.config.php b/apps.config.php new file mode 100644 index 0000000..a4bed83 --- /dev/null +++ b/apps.config.php @@ -0,0 +1,15 @@ + array ( + 0 => array ( + "path" => OC::$SERVERROOT."/apps", + "url" => "/apps", + "writable" => false, + ), + 1 => array ( + "path" => OC::$SERVERROOT."/custom_apps", + "url" => "/custom_apps", + "writable" => true, + ), + ), +); diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index d747ead..1d40304 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -22,17 +22,13 @@ if version_greater "$image_version" "$installed_version"; then su - www-data -s /bin/bash -c 'php /var/www/html/occ app:list' > /tmp/list_before fi - rsync -a --delete --exclude /config/ --exclude /data/ --exclude /apps/ /usr/src/nextcloud/ /var/www/html/ + rsync -a --delete --exclude /config/ --exclude /data/ --exclude /custom_apps/ /usr/src/nextcloud/ /var/www/html/ if [ ! -d /var/www/html/config ]; then cp -arT /usr/src/nextcloud/config /var/www/html/config fi - mkdir -p /var/www/html/apps - for app in `find /usr/src/nextcloud/apps -maxdepth 1 -mindepth 1 -type d | cut -d / -f 6`; do - rm -rf /var/www/html/apps/$app - cp -arT /usr/src/nextcloud/apps/$app /var/www/html/apps/$app - done + mkdir -p /var/www/html/custom_apps chown -R www-data /var/www/html diff --git a/update.sh b/update.sh index 4c41d75..352820b 100755 --- a/update.sh +++ b/update.sh @@ -46,6 +46,9 @@ for latest in "${latests[@]}"; do # Copy the docker-entrypoint. cp docker-entrypoint.sh "$version/$variant/docker-entrypoint.sh" + # Copy apps.config.php + cp apps.config.php "$version/$variant/apps.config.php" + travisEnv='\n - VERSION='"$version"' VARIANT='"$variant$travisEnv" done done From 07a10828d6cb822fec03559a0112d23151068097 Mon Sep 17 00:00:00 2001 From: Tilo Spannagel Date: Tue, 18 Apr 2017 09:05:53 +0200 Subject: [PATCH 6/8] disable the updater --- 10.0/apache/Dockerfile | 3 ++- 10.0/fpm/Dockerfile | 3 ++- 11.0/apache/Dockerfile | 3 ++- 11.0/fpm/Dockerfile | 3 ++- 9.0/apache/Dockerfile | 3 ++- 9.0/fpm/Dockerfile | 3 ++- Dockerfile-php7.template | 3 ++- Dockerfile.template | 3 ++- 8 files changed, 16 insertions(+), 8 deletions(-) diff --git a/10.0/apache/Dockerfile b/10.0/apache/Dockerfile index 1a51103..51f65a0 100644 --- a/10.0/apache/Dockerfile +++ b/10.0/apache/Dockerfile @@ -53,7 +53,8 @@ RUN curl -fsSL -o nextcloud.tar.bz2 \ && gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2 \ && rm -r "$GNUPGHOME" nextcloud.tar.bz2.asc \ && tar -xjf nextcloud.tar.bz2 -C /usr/src/ \ - && rm nextcloud.tar.bz2 + && rm nextcloud.tar.bz2 \ + && rm -rf /usr/src/nextcloud/updater COPY docker-entrypoint.sh /entrypoint.sh COPY apps.config.php /usr/src/nextcloud/config/apps.config.php diff --git a/10.0/fpm/Dockerfile b/10.0/fpm/Dockerfile index 6e01430..c8861c3 100644 --- a/10.0/fpm/Dockerfile +++ b/10.0/fpm/Dockerfile @@ -51,7 +51,8 @@ RUN curl -fsSL -o nextcloud.tar.bz2 \ && gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2 \ && rm -r "$GNUPGHOME" nextcloud.tar.bz2.asc \ && tar -xjf nextcloud.tar.bz2 -C /usr/src/ \ - && rm nextcloud.tar.bz2 + && rm nextcloud.tar.bz2 \ + && rm -rf /usr/src/nextcloud/updater COPY docker-entrypoint.sh /entrypoint.sh COPY apps.config.php /usr/src/nextcloud/config/apps.config.php diff --git a/11.0/apache/Dockerfile b/11.0/apache/Dockerfile index 8fe705f..6171654 100644 --- a/11.0/apache/Dockerfile +++ b/11.0/apache/Dockerfile @@ -53,7 +53,8 @@ RUN curl -fsSL -o nextcloud.tar.bz2 \ && gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2 \ && rm -r "$GNUPGHOME" nextcloud.tar.bz2.asc \ && tar -xjf nextcloud.tar.bz2 -C /usr/src/ \ - && rm nextcloud.tar.bz2 + && rm nextcloud.tar.bz2 \ + && rm -rf /usr/src/nextcloud/updater COPY docker-entrypoint.sh /entrypoint.sh COPY apps.config.php /usr/src/nextcloud/config/apps.config.php diff --git a/11.0/fpm/Dockerfile b/11.0/fpm/Dockerfile index c77129a..82bc3c6 100644 --- a/11.0/fpm/Dockerfile +++ b/11.0/fpm/Dockerfile @@ -51,7 +51,8 @@ RUN curl -fsSL -o nextcloud.tar.bz2 \ && gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2 \ && rm -r "$GNUPGHOME" nextcloud.tar.bz2.asc \ && tar -xjf nextcloud.tar.bz2 -C /usr/src/ \ - && rm nextcloud.tar.bz2 + && rm nextcloud.tar.bz2 \ + && rm -rf /usr/src/nextcloud/updater COPY docker-entrypoint.sh /entrypoint.sh COPY apps.config.php /usr/src/nextcloud/config/apps.config.php diff --git a/9.0/apache/Dockerfile b/9.0/apache/Dockerfile index d9bb364..217d0f6 100644 --- a/9.0/apache/Dockerfile +++ b/9.0/apache/Dockerfile @@ -53,7 +53,8 @@ RUN curl -fsSL -o nextcloud.tar.bz2 \ && gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2 \ && rm -r "$GNUPGHOME" nextcloud.tar.bz2.asc \ && tar -xjf nextcloud.tar.bz2 -C /usr/src/ \ - && rm nextcloud.tar.bz2 + && rm nextcloud.tar.bz2 \ + && rm -rf /usr/src/nextcloud/updater COPY docker-entrypoint.sh /entrypoint.sh COPY apps.config.php /usr/src/nextcloud/config/apps.config.php diff --git a/9.0/fpm/Dockerfile b/9.0/fpm/Dockerfile index 2b60039..fa67371 100644 --- a/9.0/fpm/Dockerfile +++ b/9.0/fpm/Dockerfile @@ -51,7 +51,8 @@ RUN curl -fsSL -o nextcloud.tar.bz2 \ && gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2 \ && rm -r "$GNUPGHOME" nextcloud.tar.bz2.asc \ && tar -xjf nextcloud.tar.bz2 -C /usr/src/ \ - && rm nextcloud.tar.bz2 + && rm nextcloud.tar.bz2 \ + && rm -rf /usr/src/nextcloud/updater COPY docker-entrypoint.sh /entrypoint.sh COPY apps.config.php /usr/src/nextcloud/config/apps.config.php diff --git a/Dockerfile-php7.template b/Dockerfile-php7.template index fe282ad..ade7622 100644 --- a/Dockerfile-php7.template +++ b/Dockerfile-php7.template @@ -53,7 +53,8 @@ RUN curl -fsSL -o nextcloud.tar.bz2 \ && gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2 \ && rm -r "$GNUPGHOME" nextcloud.tar.bz2.asc \ && tar -xjf nextcloud.tar.bz2 -C /usr/src/ \ - && rm nextcloud.tar.bz2 + && rm nextcloud.tar.bz2 \ + && rm -rf /usr/src/nextcloud/updater COPY docker-entrypoint.sh /entrypoint.sh COPY apps.config.php /usr/src/nextcloud/config/apps.config.php diff --git a/Dockerfile.template b/Dockerfile.template index abfa9bc..23ac040 100644 --- a/Dockerfile.template +++ b/Dockerfile.template @@ -53,7 +53,8 @@ RUN curl -fsSL -o nextcloud.tar.bz2 \ && gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2 \ && rm -r "$GNUPGHOME" nextcloud.tar.bz2.asc \ && tar -xjf nextcloud.tar.bz2 -C /usr/src/ \ - && rm nextcloud.tar.bz2 + && rm nextcloud.tar.bz2 \ + && rm -rf /usr/src/nextcloud/updater COPY docker-entrypoint.sh /entrypoint.sh COPY apps.config.php /usr/src/nextcloud/config/apps.config.php From 201d934bb613d202ed3a6e50e90ecf11c0cd5afc Mon Sep 17 00:00:00 2001 From: Tilo Spannagel Date: Wed, 19 Apr 2017 09:17:59 +0200 Subject: [PATCH 7/8] more specific downgrade message --- 10.0/apache/docker-entrypoint.sh | 2 +- 10.0/fpm/docker-entrypoint.sh | 2 +- 11.0/apache/docker-entrypoint.sh | 2 +- 11.0/fpm/docker-entrypoint.sh | 2 +- 9.0/apache/docker-entrypoint.sh | 2 +- 9.0/fpm/docker-entrypoint.sh | 2 +- docker-entrypoint.sh | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/10.0/apache/docker-entrypoint.sh b/10.0/apache/docker-entrypoint.sh index 1d40304..7c17114 100755 --- a/10.0/apache/docker-entrypoint.sh +++ b/10.0/apache/docker-entrypoint.sh @@ -13,7 +13,7 @@ fi image_version=$(php -r 'require "/usr/src/nextcloud/version.php"; echo "$OC_VersionString";') if version_greater "$installed_version" "$image_version"; then - echo "Downgrade not supported" + echo "Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?" exit 1 fi diff --git a/10.0/fpm/docker-entrypoint.sh b/10.0/fpm/docker-entrypoint.sh index 1d40304..7c17114 100755 --- a/10.0/fpm/docker-entrypoint.sh +++ b/10.0/fpm/docker-entrypoint.sh @@ -13,7 +13,7 @@ fi image_version=$(php -r 'require "/usr/src/nextcloud/version.php"; echo "$OC_VersionString";') if version_greater "$installed_version" "$image_version"; then - echo "Downgrade not supported" + echo "Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?" exit 1 fi diff --git a/11.0/apache/docker-entrypoint.sh b/11.0/apache/docker-entrypoint.sh index 1d40304..7c17114 100755 --- a/11.0/apache/docker-entrypoint.sh +++ b/11.0/apache/docker-entrypoint.sh @@ -13,7 +13,7 @@ fi image_version=$(php -r 'require "/usr/src/nextcloud/version.php"; echo "$OC_VersionString";') if version_greater "$installed_version" "$image_version"; then - echo "Downgrade not supported" + echo "Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?" exit 1 fi diff --git a/11.0/fpm/docker-entrypoint.sh b/11.0/fpm/docker-entrypoint.sh index 1d40304..7c17114 100755 --- a/11.0/fpm/docker-entrypoint.sh +++ b/11.0/fpm/docker-entrypoint.sh @@ -13,7 +13,7 @@ fi image_version=$(php -r 'require "/usr/src/nextcloud/version.php"; echo "$OC_VersionString";') if version_greater "$installed_version" "$image_version"; then - echo "Downgrade not supported" + echo "Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?" exit 1 fi diff --git a/9.0/apache/docker-entrypoint.sh b/9.0/apache/docker-entrypoint.sh index 1d40304..7c17114 100755 --- a/9.0/apache/docker-entrypoint.sh +++ b/9.0/apache/docker-entrypoint.sh @@ -13,7 +13,7 @@ fi image_version=$(php -r 'require "/usr/src/nextcloud/version.php"; echo "$OC_VersionString";') if version_greater "$installed_version" "$image_version"; then - echo "Downgrade not supported" + echo "Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?" exit 1 fi diff --git a/9.0/fpm/docker-entrypoint.sh b/9.0/fpm/docker-entrypoint.sh index 1d40304..7c17114 100755 --- a/9.0/fpm/docker-entrypoint.sh +++ b/9.0/fpm/docker-entrypoint.sh @@ -13,7 +13,7 @@ fi image_version=$(php -r 'require "/usr/src/nextcloud/version.php"; echo "$OC_VersionString";') if version_greater "$installed_version" "$image_version"; then - echo "Downgrade not supported" + echo "Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?" exit 1 fi diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 1d40304..7c17114 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -13,7 +13,7 @@ fi image_version=$(php -r 'require "/usr/src/nextcloud/version.php"; echo "$OC_VersionString";') if version_greater "$installed_version" "$image_version"; then - echo "Downgrade not supported" + echo "Can't start Nextcloud because the version of the data ($installed_version) is higher than the docker image version ($image_version) and downgrading is not supported. Are you sure you have pulled the newest image version?" exit 1 fi From d253cc11713122ca49e8bb1857ac9e6772440d20 Mon Sep 17 00:00:00 2001 From: Tilo Spannagel Date: Wed, 19 Apr 2017 19:29:51 +0200 Subject: [PATCH 8/8] strong permissions --- 10.0/apache/Dockerfile | 13 ++++++++++++- 10.0/apache/docker-entrypoint.sh | 9 +++++++-- 10.0/fpm/Dockerfile | 13 ++++++++++++- 10.0/fpm/docker-entrypoint.sh | 9 +++++++-- 11.0/apache/Dockerfile | 13 ++++++++++++- 11.0/apache/docker-entrypoint.sh | 9 +++++++-- 11.0/fpm/Dockerfile | 13 ++++++++++++- 11.0/fpm/docker-entrypoint.sh | 9 +++++++-- 9.0/apache/Dockerfile | 17 ++++++++++++++++- 9.0/apache/docker-entrypoint.sh | 9 +++++++-- 9.0/fpm/Dockerfile | 17 ++++++++++++++++- 9.0/fpm/docker-entrypoint.sh | 9 +++++++-- Dockerfile-php7.template | 17 ++++++++++++++++- Dockerfile.template | 17 ++++++++++++++++- docker-entrypoint.sh | 9 +++++++-- update.sh | 5 +++++ 16 files changed, 166 insertions(+), 22 deletions(-) diff --git a/10.0/apache/Dockerfile b/10.0/apache/Dockerfile index 51f65a0..95ac1e4 100644 --- a/10.0/apache/Dockerfile +++ b/10.0/apache/Dockerfile @@ -54,7 +54,18 @@ RUN curl -fsSL -o nextcloud.tar.bz2 \ && rm -r "$GNUPGHOME" nextcloud.tar.bz2.asc \ && tar -xjf nextcloud.tar.bz2 -C /usr/src/ \ && rm nextcloud.tar.bz2 \ - && rm -rf /usr/src/nextcloud/updater + && rm -rf /usr/src/nextcloud/updater \ + # https://docs.nextcloud.com/server/11/admin_manual/installation/installation_wizard.html#setting-strong-directory-permissions + && mkdir -p /usr/src/nextcloud/data \ + && mkdir -p /usr/src/nextcloud/custom_apps \ + && find /usr/src/nextcloud/ -type f -print0 | xargs -0 chmod 0640 \ + && find /usr/src/nextcloud/ -type d -print0 | xargs -0 chmod 0750 \ + && chown -R root:www-data /usr/src/nextcloud/ \ + && chown -R www-data:www-data /usr/src/nextcloud/custom_apps/ \ + && chown -R www-data:www-data /usr/src/nextcloud/config/ \ + && chown -R www-data:www-data /usr/src/nextcloud/data/ \ + && chown -R www-data:www-data /usr/src/nextcloud/themes/ \ + && chmod +x /usr/src/nextcloud/occ COPY docker-entrypoint.sh /entrypoint.sh COPY apps.config.php /usr/src/nextcloud/config/apps.config.php diff --git a/10.0/apache/docker-entrypoint.sh b/10.0/apache/docker-entrypoint.sh index 7c17114..b2bf65e 100755 --- a/10.0/apache/docker-entrypoint.sh +++ b/10.0/apache/docker-entrypoint.sh @@ -28,9 +28,14 @@ if version_greater "$image_version" "$installed_version"; then cp -arT /usr/src/nextcloud/config /var/www/html/config fi - mkdir -p /var/www/html/custom_apps + if [ ! -d /var/www/html/data ]; then + cp -arT /usr/src/nextcloud/data /var/www/html/data + fi - chown -R www-data /var/www/html + if [ ! -d /var/www/html/custom_apps ]; then + cp -arT /usr/src/nextcloud/custom_apps /var/www/html/custom_apps + cp -a /usr/src/nextcloud/config/apps.config.php /var/www/html/config/apps.config.php + fi if [ "$installed_version" != "0.0.0~unknown" ]; then su - www-data -s /bin/bash -c 'php /var/www/html/occ upgrade --no-app-disable' diff --git a/10.0/fpm/Dockerfile b/10.0/fpm/Dockerfile index c8861c3..a726bed 100644 --- a/10.0/fpm/Dockerfile +++ b/10.0/fpm/Dockerfile @@ -52,7 +52,18 @@ RUN curl -fsSL -o nextcloud.tar.bz2 \ && rm -r "$GNUPGHOME" nextcloud.tar.bz2.asc \ && tar -xjf nextcloud.tar.bz2 -C /usr/src/ \ && rm nextcloud.tar.bz2 \ - && rm -rf /usr/src/nextcloud/updater + && rm -rf /usr/src/nextcloud/updater \ + # https://docs.nextcloud.com/server/11/admin_manual/installation/installation_wizard.html#setting-strong-directory-permissions + && mkdir -p /usr/src/nextcloud/data \ + && mkdir -p /usr/src/nextcloud/custom_apps \ + && find /usr/src/nextcloud/ -type f -print0 | xargs -0 chmod 0640 \ + && find /usr/src/nextcloud/ -type d -print0 | xargs -0 chmod 0750 \ + && chown -R root:www-data /usr/src/nextcloud/ \ + && chown -R www-data:www-data /usr/src/nextcloud/custom_apps/ \ + && chown -R www-data:www-data /usr/src/nextcloud/config/ \ + && chown -R www-data:www-data /usr/src/nextcloud/data/ \ + && chown -R www-data:www-data /usr/src/nextcloud/themes/ \ + && chmod +x /usr/src/nextcloud/occ COPY docker-entrypoint.sh /entrypoint.sh COPY apps.config.php /usr/src/nextcloud/config/apps.config.php diff --git a/10.0/fpm/docker-entrypoint.sh b/10.0/fpm/docker-entrypoint.sh index 7c17114..b2bf65e 100755 --- a/10.0/fpm/docker-entrypoint.sh +++ b/10.0/fpm/docker-entrypoint.sh @@ -28,9 +28,14 @@ if version_greater "$image_version" "$installed_version"; then cp -arT /usr/src/nextcloud/config /var/www/html/config fi - mkdir -p /var/www/html/custom_apps + if [ ! -d /var/www/html/data ]; then + cp -arT /usr/src/nextcloud/data /var/www/html/data + fi - chown -R www-data /var/www/html + if [ ! -d /var/www/html/custom_apps ]; then + cp -arT /usr/src/nextcloud/custom_apps /var/www/html/custom_apps + cp -a /usr/src/nextcloud/config/apps.config.php /var/www/html/config/apps.config.php + fi if [ "$installed_version" != "0.0.0~unknown" ]; then su - www-data -s /bin/bash -c 'php /var/www/html/occ upgrade --no-app-disable' diff --git a/11.0/apache/Dockerfile b/11.0/apache/Dockerfile index 6171654..ef9d25b 100644 --- a/11.0/apache/Dockerfile +++ b/11.0/apache/Dockerfile @@ -54,7 +54,18 @@ RUN curl -fsSL -o nextcloud.tar.bz2 \ && rm -r "$GNUPGHOME" nextcloud.tar.bz2.asc \ && tar -xjf nextcloud.tar.bz2 -C /usr/src/ \ && rm nextcloud.tar.bz2 \ - && rm -rf /usr/src/nextcloud/updater + && rm -rf /usr/src/nextcloud/updater \ + # https://docs.nextcloud.com/server/11/admin_manual/installation/installation_wizard.html#setting-strong-directory-permissions + && mkdir -p /usr/src/nextcloud/data \ + && mkdir -p /usr/src/nextcloud/custom_apps \ + && find /usr/src/nextcloud/ -type f -print0 | xargs -0 chmod 0640 \ + && find /usr/src/nextcloud/ -type d -print0 | xargs -0 chmod 0750 \ + && chown -R root:www-data /usr/src/nextcloud/ \ + && chown -R www-data:www-data /usr/src/nextcloud/custom_apps/ \ + && chown -R www-data:www-data /usr/src/nextcloud/config/ \ + && chown -R www-data:www-data /usr/src/nextcloud/data/ \ + && chown -R www-data:www-data /usr/src/nextcloud/themes/ \ + && chmod +x /usr/src/nextcloud/occ COPY docker-entrypoint.sh /entrypoint.sh COPY apps.config.php /usr/src/nextcloud/config/apps.config.php diff --git a/11.0/apache/docker-entrypoint.sh b/11.0/apache/docker-entrypoint.sh index 7c17114..b2bf65e 100755 --- a/11.0/apache/docker-entrypoint.sh +++ b/11.0/apache/docker-entrypoint.sh @@ -28,9 +28,14 @@ if version_greater "$image_version" "$installed_version"; then cp -arT /usr/src/nextcloud/config /var/www/html/config fi - mkdir -p /var/www/html/custom_apps + if [ ! -d /var/www/html/data ]; then + cp -arT /usr/src/nextcloud/data /var/www/html/data + fi - chown -R www-data /var/www/html + if [ ! -d /var/www/html/custom_apps ]; then + cp -arT /usr/src/nextcloud/custom_apps /var/www/html/custom_apps + cp -a /usr/src/nextcloud/config/apps.config.php /var/www/html/config/apps.config.php + fi if [ "$installed_version" != "0.0.0~unknown" ]; then su - www-data -s /bin/bash -c 'php /var/www/html/occ upgrade --no-app-disable' diff --git a/11.0/fpm/Dockerfile b/11.0/fpm/Dockerfile index 82bc3c6..81dedee 100644 --- a/11.0/fpm/Dockerfile +++ b/11.0/fpm/Dockerfile @@ -52,7 +52,18 @@ RUN curl -fsSL -o nextcloud.tar.bz2 \ && rm -r "$GNUPGHOME" nextcloud.tar.bz2.asc \ && tar -xjf nextcloud.tar.bz2 -C /usr/src/ \ && rm nextcloud.tar.bz2 \ - && rm -rf /usr/src/nextcloud/updater + && rm -rf /usr/src/nextcloud/updater \ + # https://docs.nextcloud.com/server/11/admin_manual/installation/installation_wizard.html#setting-strong-directory-permissions + && mkdir -p /usr/src/nextcloud/data \ + && mkdir -p /usr/src/nextcloud/custom_apps \ + && find /usr/src/nextcloud/ -type f -print0 | xargs -0 chmod 0640 \ + && find /usr/src/nextcloud/ -type d -print0 | xargs -0 chmod 0750 \ + && chown -R root:www-data /usr/src/nextcloud/ \ + && chown -R www-data:www-data /usr/src/nextcloud/custom_apps/ \ + && chown -R www-data:www-data /usr/src/nextcloud/config/ \ + && chown -R www-data:www-data /usr/src/nextcloud/data/ \ + && chown -R www-data:www-data /usr/src/nextcloud/themes/ \ + && chmod +x /usr/src/nextcloud/occ COPY docker-entrypoint.sh /entrypoint.sh COPY apps.config.php /usr/src/nextcloud/config/apps.config.php diff --git a/11.0/fpm/docker-entrypoint.sh b/11.0/fpm/docker-entrypoint.sh index 7c17114..b2bf65e 100755 --- a/11.0/fpm/docker-entrypoint.sh +++ b/11.0/fpm/docker-entrypoint.sh @@ -28,9 +28,14 @@ if version_greater "$image_version" "$installed_version"; then cp -arT /usr/src/nextcloud/config /var/www/html/config fi - mkdir -p /var/www/html/custom_apps + if [ ! -d /var/www/html/data ]; then + cp -arT /usr/src/nextcloud/data /var/www/html/data + fi - chown -R www-data /var/www/html + if [ ! -d /var/www/html/custom_apps ]; then + cp -arT /usr/src/nextcloud/custom_apps /var/www/html/custom_apps + cp -a /usr/src/nextcloud/config/apps.config.php /var/www/html/config/apps.config.php + fi if [ "$installed_version" != "0.0.0~unknown" ]; then su - www-data -s /bin/bash -c 'php /var/www/html/occ upgrade --no-app-disable' diff --git a/9.0/apache/Dockerfile b/9.0/apache/Dockerfile index 217d0f6..c619bcf 100644 --- a/9.0/apache/Dockerfile +++ b/9.0/apache/Dockerfile @@ -54,7 +54,22 @@ RUN curl -fsSL -o nextcloud.tar.bz2 \ && rm -r "$GNUPGHOME" nextcloud.tar.bz2.asc \ && tar -xjf nextcloud.tar.bz2 -C /usr/src/ \ && rm nextcloud.tar.bz2 \ - && rm -rf /usr/src/nextcloud/updater + && rm -rf /usr/src/nextcloud/updater \ + # https://docs.nextcloud.com/server/11/admin_manual/installation/installation_wizard.html#setting-strong-directory-permissions + && mkdir -p /usr/src/nextcloud/data \ + && mkdir -p /usr/src/nextcloud/custom_apps \ + # only used in nextcloud 9 (assets) + && mkdir -p /usr/src/nextcloud/assets \ + && find /usr/src/nextcloud/ -type f -print0 | xargs -0 chmod 0640 \ + && find /usr/src/nextcloud/ -type d -print0 | xargs -0 chmod 0750 \ + && chown -R root:www-data /usr/src/nextcloud/ \ + && chown -R www-data:www-data /usr/src/nextcloud/custom_apps/ \ + && chown -R www-data:www-data /usr/src/nextcloud/config/ \ + # only used in nextcloud 9 (assets) + && chown -R www-data:www-data /usr/src/nextcloud/assets/ \ + && chown -R www-data:www-data /usr/src/nextcloud/data/ \ + && chown -R www-data:www-data /usr/src/nextcloud/themes/ \ + && chmod +x /usr/src/nextcloud/occ COPY docker-entrypoint.sh /entrypoint.sh COPY apps.config.php /usr/src/nextcloud/config/apps.config.php diff --git a/9.0/apache/docker-entrypoint.sh b/9.0/apache/docker-entrypoint.sh index 7c17114..b2bf65e 100755 --- a/9.0/apache/docker-entrypoint.sh +++ b/9.0/apache/docker-entrypoint.sh @@ -28,9 +28,14 @@ if version_greater "$image_version" "$installed_version"; then cp -arT /usr/src/nextcloud/config /var/www/html/config fi - mkdir -p /var/www/html/custom_apps + if [ ! -d /var/www/html/data ]; then + cp -arT /usr/src/nextcloud/data /var/www/html/data + fi - chown -R www-data /var/www/html + if [ ! -d /var/www/html/custom_apps ]; then + cp -arT /usr/src/nextcloud/custom_apps /var/www/html/custom_apps + cp -a /usr/src/nextcloud/config/apps.config.php /var/www/html/config/apps.config.php + fi if [ "$installed_version" != "0.0.0~unknown" ]; then su - www-data -s /bin/bash -c 'php /var/www/html/occ upgrade --no-app-disable' diff --git a/9.0/fpm/Dockerfile b/9.0/fpm/Dockerfile index fa67371..160e4e9 100644 --- a/9.0/fpm/Dockerfile +++ b/9.0/fpm/Dockerfile @@ -52,7 +52,22 @@ RUN curl -fsSL -o nextcloud.tar.bz2 \ && rm -r "$GNUPGHOME" nextcloud.tar.bz2.asc \ && tar -xjf nextcloud.tar.bz2 -C /usr/src/ \ && rm nextcloud.tar.bz2 \ - && rm -rf /usr/src/nextcloud/updater + && rm -rf /usr/src/nextcloud/updater \ + # https://docs.nextcloud.com/server/11/admin_manual/installation/installation_wizard.html#setting-strong-directory-permissions + && mkdir -p /usr/src/nextcloud/data \ + && mkdir -p /usr/src/nextcloud/custom_apps \ + # only used in nextcloud 9 (assets) + && mkdir -p /usr/src/nextcloud/assets \ + && find /usr/src/nextcloud/ -type f -print0 | xargs -0 chmod 0640 \ + && find /usr/src/nextcloud/ -type d -print0 | xargs -0 chmod 0750 \ + && chown -R root:www-data /usr/src/nextcloud/ \ + && chown -R www-data:www-data /usr/src/nextcloud/custom_apps/ \ + && chown -R www-data:www-data /usr/src/nextcloud/config/ \ + # only used in nextcloud 9 (assets) + && chown -R www-data:www-data /usr/src/nextcloud/assets/ \ + && chown -R www-data:www-data /usr/src/nextcloud/data/ \ + && chown -R www-data:www-data /usr/src/nextcloud/themes/ \ + && chmod +x /usr/src/nextcloud/occ COPY docker-entrypoint.sh /entrypoint.sh COPY apps.config.php /usr/src/nextcloud/config/apps.config.php diff --git a/9.0/fpm/docker-entrypoint.sh b/9.0/fpm/docker-entrypoint.sh index 7c17114..b2bf65e 100755 --- a/9.0/fpm/docker-entrypoint.sh +++ b/9.0/fpm/docker-entrypoint.sh @@ -28,9 +28,14 @@ if version_greater "$image_version" "$installed_version"; then cp -arT /usr/src/nextcloud/config /var/www/html/config fi - mkdir -p /var/www/html/custom_apps + if [ ! -d /var/www/html/data ]; then + cp -arT /usr/src/nextcloud/data /var/www/html/data + fi - chown -R www-data /var/www/html + if [ ! -d /var/www/html/custom_apps ]; then + cp -arT /usr/src/nextcloud/custom_apps /var/www/html/custom_apps + cp -a /usr/src/nextcloud/config/apps.config.php /var/www/html/config/apps.config.php + fi if [ "$installed_version" != "0.0.0~unknown" ]; then su - www-data -s /bin/bash -c 'php /var/www/html/occ upgrade --no-app-disable' diff --git a/Dockerfile-php7.template b/Dockerfile-php7.template index ade7622..345009d 100644 --- a/Dockerfile-php7.template +++ b/Dockerfile-php7.template @@ -54,7 +54,22 @@ RUN curl -fsSL -o nextcloud.tar.bz2 \ && rm -r "$GNUPGHOME" nextcloud.tar.bz2.asc \ && tar -xjf nextcloud.tar.bz2 -C /usr/src/ \ && rm nextcloud.tar.bz2 \ - && rm -rf /usr/src/nextcloud/updater + && rm -rf /usr/src/nextcloud/updater \ + # https://docs.nextcloud.com/server/11/admin_manual/installation/installation_wizard.html#setting-strong-directory-permissions + && mkdir -p /usr/src/nextcloud/data \ + && mkdir -p /usr/src/nextcloud/custom_apps \ + # only used in nextcloud 9 (assets) + && mkdir -p /usr/src/nextcloud/assets \ + && find /usr/src/nextcloud/ -type f -print0 | xargs -0 chmod 0640 \ + && find /usr/src/nextcloud/ -type d -print0 | xargs -0 chmod 0750 \ + && chown -R root:www-data /usr/src/nextcloud/ \ + && chown -R www-data:www-data /usr/src/nextcloud/custom_apps/ \ + && chown -R www-data:www-data /usr/src/nextcloud/config/ \ + # only used in nextcloud 9 (assets) + && chown -R www-data:www-data /usr/src/nextcloud/assets/ \ + && chown -R www-data:www-data /usr/src/nextcloud/data/ \ + && chown -R www-data:www-data /usr/src/nextcloud/themes/ \ + && chmod +x /usr/src/nextcloud/occ COPY docker-entrypoint.sh /entrypoint.sh COPY apps.config.php /usr/src/nextcloud/config/apps.config.php diff --git a/Dockerfile.template b/Dockerfile.template index 23ac040..24ef5e9 100644 --- a/Dockerfile.template +++ b/Dockerfile.template @@ -54,7 +54,22 @@ RUN curl -fsSL -o nextcloud.tar.bz2 \ && rm -r "$GNUPGHOME" nextcloud.tar.bz2.asc \ && tar -xjf nextcloud.tar.bz2 -C /usr/src/ \ && rm nextcloud.tar.bz2 \ - && rm -rf /usr/src/nextcloud/updater + && rm -rf /usr/src/nextcloud/updater \ + # https://docs.nextcloud.com/server/11/admin_manual/installation/installation_wizard.html#setting-strong-directory-permissions + && mkdir -p /usr/src/nextcloud/data \ + && mkdir -p /usr/src/nextcloud/custom_apps \ + # only used in nextcloud 9 (assets) + && mkdir -p /usr/src/nextcloud/assets \ + && find /usr/src/nextcloud/ -type f -print0 | xargs -0 chmod 0640 \ + && find /usr/src/nextcloud/ -type d -print0 | xargs -0 chmod 0750 \ + && chown -R root:www-data /usr/src/nextcloud/ \ + && chown -R www-data:www-data /usr/src/nextcloud/custom_apps/ \ + && chown -R www-data:www-data /usr/src/nextcloud/config/ \ + # only used in nextcloud 9 (assets) + && chown -R www-data:www-data /usr/src/nextcloud/assets/ \ + && chown -R www-data:www-data /usr/src/nextcloud/data/ \ + && chown -R www-data:www-data /usr/src/nextcloud/themes/ \ + && chmod +x /usr/src/nextcloud/occ COPY docker-entrypoint.sh /entrypoint.sh COPY apps.config.php /usr/src/nextcloud/config/apps.config.php diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 7c17114..b2bf65e 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -28,9 +28,14 @@ if version_greater "$image_version" "$installed_version"; then cp -arT /usr/src/nextcloud/config /var/www/html/config fi - mkdir -p /var/www/html/custom_apps + if [ ! -d /var/www/html/data ]; then + cp -arT /usr/src/nextcloud/data /var/www/html/data + fi - chown -R www-data /var/www/html + if [ ! -d /var/www/html/custom_apps ]; then + cp -arT /usr/src/nextcloud/custom_apps /var/www/html/custom_apps + cp -a /usr/src/nextcloud/config/apps.config.php /var/www/html/config/apps.config.php + fi if [ "$installed_version" != "0.0.0~unknown" ]; then su - www-data -s /bin/bash -c 'php /var/www/html/occ upgrade --no-app-disable' diff --git a/update.sh b/update.sh index 352820b..8fd447e 100755 --- a/update.sh +++ b/update.sh @@ -43,6 +43,11 @@ for latest in "${latests[@]}"; do sed -ri -e '/a2enmod/d' "$version/$variant/Dockerfile" fi + # Remove the assets folder if version >= 10.0 + if version_greater_or_equal "$version" "10.0"; then + sed -ri -e '/assets/d' "$version/$variant/Dockerfile" + fi + # Copy the docker-entrypoint. cp docker-entrypoint.sh "$version/$variant/docker-entrypoint.sh"