0
0
Fork 0
mirror of https://github.com/nextcloud/docker.git synced 2025-04-20 10:56:08 +02:00

Compare commits

...

4 commits

Author SHA1 Message Date
Stephan Brunner
ddd41f4e43
Merge 4df45e7ac3 into 3adaf30839 2025-03-31 13:51:34 +12:00
Stephan Brunner
4df45e7ac3 Replace tab vs spaces to align code style
Signed-off-by: Stephan Brunner <s.brunner@stephan-brunner.net>
2025-03-02 09:55:34 +01:00
Stephan Brunner
d6b4877b36 Add ability to force reinitialization by putting a marker file in the tmp folder
We have a custom image where we'd like to recopy all of nextcloud's
source code again when we update some internal thing without a change in
Nextcloud's version. The newly added pre-initialization hook can be used
to determine this and force a rerun.

Signed-off-by: Stephan Brunner <s.brunner@stephan-brunner.net>
2025-03-02 09:55:34 +01:00
Stephan Brunner
5bbbde3734 Add pre-initialization hook
Allow execution of scripts even before the need to install or update
Nextcloud is determined. Useful when needing to have additional update
condition checks.

Signed-off-by: Stephan Brunner <s.brunner@stephan-brunner.net>
2025-03-02 09:55:34 +01:00
22 changed files with 215 additions and 22 deletions

View file

@ -140,7 +140,8 @@ RUN { \
} > "${PHP_INI_DIR}/conf.d/nextcloud.ini"; \ } > "${PHP_INI_DIR}/conf.d/nextcloud.ini"; \
\ \
mkdir /var/www/data; \ mkdir /var/www/data; \
mkdir -p /docker-entrypoint-hooks.d/pre-installation \ mkdir -p /docker-entrypoint-hooks.d/pre-initialization \
/docker-entrypoint-hooks.d/pre-installation \
/docker-entrypoint-hooks.d/post-installation \ /docker-entrypoint-hooks.d/post-installation \
/docker-entrypoint-hooks.d/pre-upgrade \ /docker-entrypoint-hooks.d/pre-upgrade \
/docker-entrypoint-hooks.d/post-upgrade \ /docker-entrypoint-hooks.d/post-upgrade \

View file

@ -141,6 +141,8 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
flock 9 flock 9
fi fi
run_path pre-initialization
installed_version="0.0.0.0" installed_version="0.0.0.0"
if [ -f /var/www/html/version.php ]; then if [ -f /var/www/html/version.php ]; then
# shellcheck disable=SC2016 # shellcheck disable=SC2016
@ -154,7 +156,18 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
exit 1 exit 1
fi fi
need_initialization=false
if version_greater "$image_version" "$installed_version"; then if version_greater "$image_version" "$installed_version"; then
need_initialization=true
fi
if [ -f /tmp/nextcloud-force-initialization ]; then
echo Found /tmp/nextcloud-force-initialization, forcing initialization
need_initialization=true
fi
if [ "true" = "$need_initialization" ]; then
echo "Initializing nextcloud $image_version ..." echo "Initializing nextcloud $image_version ..."
if [ "$installed_version" != "0.0.0.0" ]; then if [ "$installed_version" != "0.0.0.0" ]; then
if [ "${image_version%%.*}" -gt "$((${installed_version%%.*} + 1))" ]; then if [ "${image_version%%.*}" -gt "$((${installed_version%%.*} + 1))" ]; then
@ -267,6 +280,10 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
run_path post-upgrade run_path post-upgrade
fi fi
if [ -f /tmp/nextcloud-force-initialization ]; then
rm /tmp/nextcloud-force-initialization
fi
echo "Initializing finished" echo "Initializing finished"
fi fi

View file

@ -135,7 +135,8 @@ RUN { \
} > "${PHP_INI_DIR}/conf.d/nextcloud.ini"; \ } > "${PHP_INI_DIR}/conf.d/nextcloud.ini"; \
\ \
mkdir /var/www/data; \ mkdir /var/www/data; \
mkdir -p /docker-entrypoint-hooks.d/pre-installation \ mkdir -p /docker-entrypoint-hooks.d/pre-initialization \
/docker-entrypoint-hooks.d/pre-installation \
/docker-entrypoint-hooks.d/post-installation \ /docker-entrypoint-hooks.d/post-installation \
/docker-entrypoint-hooks.d/pre-upgrade \ /docker-entrypoint-hooks.d/pre-upgrade \
/docker-entrypoint-hooks.d/post-upgrade \ /docker-entrypoint-hooks.d/post-upgrade \

View file

@ -141,6 +141,8 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
flock 9 flock 9
fi fi
run_path pre-initialization
installed_version="0.0.0.0" installed_version="0.0.0.0"
if [ -f /var/www/html/version.php ]; then if [ -f /var/www/html/version.php ]; then
# shellcheck disable=SC2016 # shellcheck disable=SC2016
@ -154,7 +156,18 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
exit 1 exit 1
fi fi
need_initialization=false
if version_greater "$image_version" "$installed_version"; then if version_greater "$image_version" "$installed_version"; then
need_initialization=true
fi
if [ -f /tmp/nextcloud-force-initialization ]; then
echo Found /tmp/nextcloud-force-initialization, forcing initialization
need_initialization=true
fi
if [ "true" = "$need_initialization" ]; then
echo "Initializing nextcloud $image_version ..." echo "Initializing nextcloud $image_version ..."
if [ "$installed_version" != "0.0.0.0" ]; then if [ "$installed_version" != "0.0.0.0" ]; then
if [ "${image_version%%.*}" -gt "$((${installed_version%%.*} + 1))" ]; then if [ "${image_version%%.*}" -gt "$((${installed_version%%.*} + 1))" ]; then
@ -267,6 +280,10 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
run_path post-upgrade run_path post-upgrade
fi fi
if [ -f /tmp/nextcloud-force-initialization ]; then
rm /tmp/nextcloud-force-initialization
fi
echo "Initializing finished" echo "Initializing finished"
fi fi

View file

@ -140,7 +140,8 @@ RUN { \
} > "${PHP_INI_DIR}/conf.d/nextcloud.ini"; \ } > "${PHP_INI_DIR}/conf.d/nextcloud.ini"; \
\ \
mkdir /var/www/data; \ mkdir /var/www/data; \
mkdir -p /docker-entrypoint-hooks.d/pre-installation \ mkdir -p /docker-entrypoint-hooks.d/pre-initialization \
/docker-entrypoint-hooks.d/pre-installation \
/docker-entrypoint-hooks.d/post-installation \ /docker-entrypoint-hooks.d/post-installation \
/docker-entrypoint-hooks.d/pre-upgrade \ /docker-entrypoint-hooks.d/pre-upgrade \
/docker-entrypoint-hooks.d/post-upgrade \ /docker-entrypoint-hooks.d/post-upgrade \

View file

@ -141,6 +141,8 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
flock 9 flock 9
fi fi
run_path pre-initialization
installed_version="0.0.0.0" installed_version="0.0.0.0"
if [ -f /var/www/html/version.php ]; then if [ -f /var/www/html/version.php ]; then
# shellcheck disable=SC2016 # shellcheck disable=SC2016
@ -154,7 +156,18 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
exit 1 exit 1
fi fi
need_initialization=false
if version_greater "$image_version" "$installed_version"; then if version_greater "$image_version" "$installed_version"; then
need_initialization=true
fi
if [ -f /tmp/nextcloud-force-initialization ]; then
echo Found /tmp/nextcloud-force-initialization, forcing initialization
need_initialization=true
fi
if [ "true" = "$need_initialization" ]; then
echo "Initializing nextcloud $image_version ..." echo "Initializing nextcloud $image_version ..."
if [ "$installed_version" != "0.0.0.0" ]; then if [ "$installed_version" != "0.0.0.0" ]; then
if [ "${image_version%%.*}" -gt "$((${installed_version%%.*} + 1))" ]; then if [ "${image_version%%.*}" -gt "$((${installed_version%%.*} + 1))" ]; then
@ -267,6 +280,10 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
run_path post-upgrade run_path post-upgrade
fi fi
if [ -f /tmp/nextcloud-force-initialization ]; then
rm /tmp/nextcloud-force-initialization
fi
echo "Initializing finished" echo "Initializing finished"
fi fi

View file

@ -140,7 +140,8 @@ RUN { \
} > "${PHP_INI_DIR}/conf.d/nextcloud.ini"; \ } > "${PHP_INI_DIR}/conf.d/nextcloud.ini"; \
\ \
mkdir /var/www/data; \ mkdir /var/www/data; \
mkdir -p /docker-entrypoint-hooks.d/pre-installation \ mkdir -p /docker-entrypoint-hooks.d/pre-initialization \
/docker-entrypoint-hooks.d/pre-installation \
/docker-entrypoint-hooks.d/post-installation \ /docker-entrypoint-hooks.d/post-installation \
/docker-entrypoint-hooks.d/pre-upgrade \ /docker-entrypoint-hooks.d/pre-upgrade \
/docker-entrypoint-hooks.d/post-upgrade \ /docker-entrypoint-hooks.d/post-upgrade \

View file

@ -141,6 +141,8 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
flock 9 flock 9
fi fi
run_path pre-initialization
installed_version="0.0.0.0" installed_version="0.0.0.0"
if [ -f /var/www/html/version.php ]; then if [ -f /var/www/html/version.php ]; then
# shellcheck disable=SC2016 # shellcheck disable=SC2016
@ -154,7 +156,18 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
exit 1 exit 1
fi fi
need_initialization=false
if version_greater "$image_version" "$installed_version"; then if version_greater "$image_version" "$installed_version"; then
need_initialization=true
fi
if [ -f /tmp/nextcloud-force-initialization ]; then
echo Found /tmp/nextcloud-force-initialization, forcing initialization
need_initialization=true
fi
if [ "true" = "$need_initialization" ]; then
echo "Initializing nextcloud $image_version ..." echo "Initializing nextcloud $image_version ..."
if [ "$installed_version" != "0.0.0.0" ]; then if [ "$installed_version" != "0.0.0.0" ]; then
if [ "${image_version%%.*}" -gt "$((${installed_version%%.*} + 1))" ]; then if [ "${image_version%%.*}" -gt "$((${installed_version%%.*} + 1))" ]; then
@ -267,6 +280,10 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
run_path post-upgrade run_path post-upgrade
fi fi
if [ -f /tmp/nextcloud-force-initialization ]; then
rm /tmp/nextcloud-force-initialization
fi
echo "Initializing finished" echo "Initializing finished"
fi fi

View file

@ -135,7 +135,8 @@ RUN { \
} > "${PHP_INI_DIR}/conf.d/nextcloud.ini"; \ } > "${PHP_INI_DIR}/conf.d/nextcloud.ini"; \
\ \
mkdir /var/www/data; \ mkdir /var/www/data; \
mkdir -p /docker-entrypoint-hooks.d/pre-installation \ mkdir -p /docker-entrypoint-hooks.d/pre-initialization \
/docker-entrypoint-hooks.d/pre-installation \
/docker-entrypoint-hooks.d/post-installation \ /docker-entrypoint-hooks.d/post-installation \
/docker-entrypoint-hooks.d/pre-upgrade \ /docker-entrypoint-hooks.d/pre-upgrade \
/docker-entrypoint-hooks.d/post-upgrade \ /docker-entrypoint-hooks.d/post-upgrade \

View file

@ -141,6 +141,8 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
flock 9 flock 9
fi fi
run_path pre-initialization
installed_version="0.0.0.0" installed_version="0.0.0.0"
if [ -f /var/www/html/version.php ]; then if [ -f /var/www/html/version.php ]; then
# shellcheck disable=SC2016 # shellcheck disable=SC2016
@ -154,7 +156,18 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
exit 1 exit 1
fi fi
need_initialization=false
if version_greater "$image_version" "$installed_version"; then if version_greater "$image_version" "$installed_version"; then
need_initialization=true
fi
if [ -f /tmp/nextcloud-force-initialization ]; then
echo Found /tmp/nextcloud-force-initialization, forcing initialization
need_initialization=true
fi
if [ "true" = "$need_initialization" ]; then
echo "Initializing nextcloud $image_version ..." echo "Initializing nextcloud $image_version ..."
if [ "$installed_version" != "0.0.0.0" ]; then if [ "$installed_version" != "0.0.0.0" ]; then
if [ "${image_version%%.*}" -gt "$((${installed_version%%.*} + 1))" ]; then if [ "${image_version%%.*}" -gt "$((${installed_version%%.*} + 1))" ]; then
@ -267,6 +280,10 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
run_path post-upgrade run_path post-upgrade
fi fi
if [ -f /tmp/nextcloud-force-initialization ]; then
rm /tmp/nextcloud-force-initialization
fi
echo "Initializing finished" echo "Initializing finished"
fi fi

View file

@ -140,7 +140,8 @@ RUN { \
} > "${PHP_INI_DIR}/conf.d/nextcloud.ini"; \ } > "${PHP_INI_DIR}/conf.d/nextcloud.ini"; \
\ \
mkdir /var/www/data; \ mkdir /var/www/data; \
mkdir -p /docker-entrypoint-hooks.d/pre-installation \ mkdir -p /docker-entrypoint-hooks.d/pre-initialization \
/docker-entrypoint-hooks.d/pre-installation \
/docker-entrypoint-hooks.d/post-installation \ /docker-entrypoint-hooks.d/post-installation \
/docker-entrypoint-hooks.d/pre-upgrade \ /docker-entrypoint-hooks.d/pre-upgrade \
/docker-entrypoint-hooks.d/post-upgrade \ /docker-entrypoint-hooks.d/post-upgrade \

View file

@ -141,6 +141,8 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
flock 9 flock 9
fi fi
run_path pre-initialization
installed_version="0.0.0.0" installed_version="0.0.0.0"
if [ -f /var/www/html/version.php ]; then if [ -f /var/www/html/version.php ]; then
# shellcheck disable=SC2016 # shellcheck disable=SC2016
@ -154,7 +156,18 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
exit 1 exit 1
fi fi
need_initialization=false
if version_greater "$image_version" "$installed_version"; then if version_greater "$image_version" "$installed_version"; then
need_initialization=true
fi
if [ -f /tmp/nextcloud-force-initialization ]; then
echo Found /tmp/nextcloud-force-initialization, forcing initialization
need_initialization=true
fi
if [ "true" = "$need_initialization" ]; then
echo "Initializing nextcloud $image_version ..." echo "Initializing nextcloud $image_version ..."
if [ "$installed_version" != "0.0.0.0" ]; then if [ "$installed_version" != "0.0.0.0" ]; then
if [ "${image_version%%.*}" -gt "$((${installed_version%%.*} + 1))" ]; then if [ "${image_version%%.*}" -gt "$((${installed_version%%.*} + 1))" ]; then
@ -267,6 +280,10 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
run_path post-upgrade run_path post-upgrade
fi fi
if [ -f /tmp/nextcloud-force-initialization ]; then
rm /tmp/nextcloud-force-initialization
fi
echo "Initializing finished" echo "Initializing finished"
fi fi

View file

@ -140,7 +140,8 @@ RUN { \
} > "${PHP_INI_DIR}/conf.d/nextcloud.ini"; \ } > "${PHP_INI_DIR}/conf.d/nextcloud.ini"; \
\ \
mkdir /var/www/data; \ mkdir /var/www/data; \
mkdir -p /docker-entrypoint-hooks.d/pre-installation \ mkdir -p /docker-entrypoint-hooks.d/pre-initialization \
/docker-entrypoint-hooks.d/pre-installation \
/docker-entrypoint-hooks.d/post-installation \ /docker-entrypoint-hooks.d/post-installation \
/docker-entrypoint-hooks.d/pre-upgrade \ /docker-entrypoint-hooks.d/pre-upgrade \
/docker-entrypoint-hooks.d/post-upgrade \ /docker-entrypoint-hooks.d/post-upgrade \

View file

@ -141,6 +141,8 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
flock 9 flock 9
fi fi
run_path pre-initialization
installed_version="0.0.0.0" installed_version="0.0.0.0"
if [ -f /var/www/html/version.php ]; then if [ -f /var/www/html/version.php ]; then
# shellcheck disable=SC2016 # shellcheck disable=SC2016
@ -154,7 +156,18 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
exit 1 exit 1
fi fi
need_initialization=false
if version_greater "$image_version" "$installed_version"; then if version_greater "$image_version" "$installed_version"; then
need_initialization=true
fi
if [ -f /tmp/nextcloud-force-initialization ]; then
echo Found /tmp/nextcloud-force-initialization, forcing initialization
need_initialization=true
fi
if [ "true" = "$need_initialization" ]; then
echo "Initializing nextcloud $image_version ..." echo "Initializing nextcloud $image_version ..."
if [ "$installed_version" != "0.0.0.0" ]; then if [ "$installed_version" != "0.0.0.0" ]; then
if [ "${image_version%%.*}" -gt "$((${installed_version%%.*} + 1))" ]; then if [ "${image_version%%.*}" -gt "$((${installed_version%%.*} + 1))" ]; then
@ -267,6 +280,10 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
run_path post-upgrade run_path post-upgrade
fi fi
if [ -f /tmp/nextcloud-force-initialization ]; then
rm /tmp/nextcloud-force-initialization
fi
echo "Initializing finished" echo "Initializing finished"
fi fi

View file

@ -135,7 +135,8 @@ RUN { \
} > "${PHP_INI_DIR}/conf.d/nextcloud.ini"; \ } > "${PHP_INI_DIR}/conf.d/nextcloud.ini"; \
\ \
mkdir /var/www/data; \ mkdir /var/www/data; \
mkdir -p /docker-entrypoint-hooks.d/pre-installation \ mkdir -p /docker-entrypoint-hooks.d/pre-initialization \
/docker-entrypoint-hooks.d/pre-installation \
/docker-entrypoint-hooks.d/post-installation \ /docker-entrypoint-hooks.d/post-installation \
/docker-entrypoint-hooks.d/pre-upgrade \ /docker-entrypoint-hooks.d/pre-upgrade \
/docker-entrypoint-hooks.d/post-upgrade \ /docker-entrypoint-hooks.d/post-upgrade \

View file

@ -141,6 +141,8 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
flock 9 flock 9
fi fi
run_path pre-initialization
installed_version="0.0.0.0" installed_version="0.0.0.0"
if [ -f /var/www/html/version.php ]; then if [ -f /var/www/html/version.php ]; then
# shellcheck disable=SC2016 # shellcheck disable=SC2016
@ -154,7 +156,18 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
exit 1 exit 1
fi fi
need_initialization=false
if version_greater "$image_version" "$installed_version"; then if version_greater "$image_version" "$installed_version"; then
need_initialization=true
fi
if [ -f /tmp/nextcloud-force-initialization ]; then
echo Found /tmp/nextcloud-force-initialization, forcing initialization
need_initialization=true
fi
if [ "true" = "$need_initialization" ]; then
echo "Initializing nextcloud $image_version ..." echo "Initializing nextcloud $image_version ..."
if [ "$installed_version" != "0.0.0.0" ]; then if [ "$installed_version" != "0.0.0.0" ]; then
if [ "${image_version%%.*}" -gt "$((${installed_version%%.*} + 1))" ]; then if [ "${image_version%%.*}" -gt "$((${installed_version%%.*} + 1))" ]; then
@ -267,6 +280,10 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
run_path post-upgrade run_path post-upgrade
fi fi
if [ -f /tmp/nextcloud-force-initialization ]; then
rm /tmp/nextcloud-force-initialization
fi
echo "Initializing finished" echo "Initializing finished"
fi fi

View file

@ -140,7 +140,8 @@ RUN { \
} > "${PHP_INI_DIR}/conf.d/nextcloud.ini"; \ } > "${PHP_INI_DIR}/conf.d/nextcloud.ini"; \
\ \
mkdir /var/www/data; \ mkdir /var/www/data; \
mkdir -p /docker-entrypoint-hooks.d/pre-installation \ mkdir -p /docker-entrypoint-hooks.d/pre-initialization \
/docker-entrypoint-hooks.d/pre-installation \
/docker-entrypoint-hooks.d/post-installation \ /docker-entrypoint-hooks.d/post-installation \
/docker-entrypoint-hooks.d/pre-upgrade \ /docker-entrypoint-hooks.d/pre-upgrade \
/docker-entrypoint-hooks.d/post-upgrade \ /docker-entrypoint-hooks.d/post-upgrade \

View file

@ -141,6 +141,8 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
flock 9 flock 9
fi fi
run_path pre-initialization
installed_version="0.0.0.0" installed_version="0.0.0.0"
if [ -f /var/www/html/version.php ]; then if [ -f /var/www/html/version.php ]; then
# shellcheck disable=SC2016 # shellcheck disable=SC2016
@ -154,7 +156,18 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
exit 1 exit 1
fi fi
need_initialization=false
if version_greater "$image_version" "$installed_version"; then if version_greater "$image_version" "$installed_version"; then
need_initialization=true
fi
if [ -f /tmp/nextcloud-force-initialization ]; then
echo Found /tmp/nextcloud-force-initialization, forcing initialization
need_initialization=true
fi
if [ "true" = "$need_initialization" ]; then
echo "Initializing nextcloud $image_version ..." echo "Initializing nextcloud $image_version ..."
if [ "$installed_version" != "0.0.0.0" ]; then if [ "$installed_version" != "0.0.0.0" ]; then
if [ "${image_version%%.*}" -gt "$((${installed_version%%.*} + 1))" ]; then if [ "${image_version%%.*}" -gt "$((${installed_version%%.*} + 1))" ]; then
@ -267,6 +280,10 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
run_path post-upgrade run_path post-upgrade
fi fi
if [ -f /tmp/nextcloud-force-initialization ]; then
rm /tmp/nextcloud-force-initialization
fi
echo "Initializing finished" echo "Initializing finished"
fi fi

View file

@ -134,7 +134,8 @@ RUN { \
} > "${PHP_INI_DIR}/conf.d/nextcloud.ini"; \ } > "${PHP_INI_DIR}/conf.d/nextcloud.ini"; \
\ \
mkdir /var/www/data; \ mkdir /var/www/data; \
mkdir -p /docker-entrypoint-hooks.d/pre-installation \ mkdir -p /docker-entrypoint-hooks.d/pre-initialization \
/docker-entrypoint-hooks.d/pre-installation \
/docker-entrypoint-hooks.d/post-installation \ /docker-entrypoint-hooks.d/post-installation \
/docker-entrypoint-hooks.d/pre-upgrade \ /docker-entrypoint-hooks.d/pre-upgrade \
/docker-entrypoint-hooks.d/post-upgrade \ /docker-entrypoint-hooks.d/post-upgrade \

View file

@ -139,7 +139,8 @@ RUN { \
} > "${PHP_INI_DIR}/conf.d/nextcloud.ini"; \ } > "${PHP_INI_DIR}/conf.d/nextcloud.ini"; \
\ \
mkdir /var/www/data; \ mkdir /var/www/data; \
mkdir -p /docker-entrypoint-hooks.d/pre-installation \ mkdir -p /docker-entrypoint-hooks.d/pre-initialization \
/docker-entrypoint-hooks.d/pre-installation \
/docker-entrypoint-hooks.d/post-installation \ /docker-entrypoint-hooks.d/post-installation \
/docker-entrypoint-hooks.d/pre-upgrade \ /docker-entrypoint-hooks.d/pre-upgrade \
/docker-entrypoint-hooks.d/post-upgrade \ /docker-entrypoint-hooks.d/post-upgrade \

View file

@ -362,8 +362,9 @@ As long as you have not modified any of the provided config files in `/var/www/h
## Auto configuration via hook folders ## Auto configuration via hook folders
There are 5 hooks There are 6 hooks
- `pre-initialization` Executed before the need to update or install Nextcloud is determined
- `pre-installation` Executed before the Nextcloud is installed/initiated - `pre-installation` Executed before the Nextcloud is installed/initiated
- `post-installation` Executed after the Nextcloud is installed/initiated - `post-installation` Executed after the Nextcloud is installed/initiated
- `pre-upgrade` Executed before the Nextcloud is upgraded - `pre-upgrade` Executed before the Nextcloud is upgraded
@ -383,6 +384,7 @@ To use the hooks triggered by the `entrypoint` script, either
image: nextcloud:stable image: nextcloud:stable
volumes: volumes:
- ./app-hooks/pre-initialization:/docker-entrypoint-hooks.d/pre-initialization
- ./app-hooks/pre-installation:/docker-entrypoint-hooks.d/pre-installation - ./app-hooks/pre-installation:/docker-entrypoint-hooks.d/pre-installation
- ./app-hooks/post-installation:/docker-entrypoint-hooks.d/post-installation - ./app-hooks/post-installation:/docker-entrypoint-hooks.d/post-installation
- ./app-hooks/pre-upgrade:/docker-entrypoint-hooks.d/pre-upgrade - ./app-hooks/pre-upgrade:/docker-entrypoint-hooks.d/pre-upgrade
@ -391,6 +393,16 @@ To use the hooks triggered by the `entrypoint` script, either
... ...
``` ```
## Forcing an upgrade run
Sometimes you need to force an explicit upgrade run even when the bundled Nextcloud version did not change.
An example would be when you have custom apps bundled and you want to update those.
To do this, you can simply create a file `/tmp/nextcloud-force-initialization` before the need for an upgrade is determined.
The content is irrelevant.
You can either create this file before starting the container, or you can use the `pre-initialization` hook to create it.
After the update has successfully run, the file is removed automatically.
# Running this image with `docker compose` # Running this image with `docker compose`
The easiest way to get a fully featured and functional setup is using a `compose.yaml` file. There are too many different possibilities to setup your system, so here are only some examples of what you have to look for. The easiest way to get a fully featured and functional setup is using a `compose.yaml` file. There are too many different possibilities to setup your system, so here are only some examples of what you have to look for.

View file

@ -141,6 +141,8 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
flock 9 flock 9
fi fi
run_path pre-initialization
installed_version="0.0.0.0" installed_version="0.0.0.0"
if [ -f /var/www/html/version.php ]; then if [ -f /var/www/html/version.php ]; then
# shellcheck disable=SC2016 # shellcheck disable=SC2016
@ -154,7 +156,18 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
exit 1 exit 1
fi fi
need_initialization=false
if version_greater "$image_version" "$installed_version"; then if version_greater "$image_version" "$installed_version"; then
need_initialization=true
fi
if [ -f /tmp/nextcloud-force-initialization ]; then
echo Found /tmp/nextcloud-force-initialization, forcing initialization
need_initialization=true
fi
if [ "true" = "$need_initialization" ]; then
echo "Initializing nextcloud $image_version ..." echo "Initializing nextcloud $image_version ..."
if [ "$installed_version" != "0.0.0.0" ]; then if [ "$installed_version" != "0.0.0.0" ]; then
if [ "${image_version%%.*}" -gt "$((${installed_version%%.*} + 1))" ]; then if [ "${image_version%%.*}" -gt "$((${installed_version%%.*} + 1))" ]; then
@ -267,6 +280,10 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
run_path post-upgrade run_path post-upgrade
fi fi
if [ -f /tmp/nextcloud-force-initialization ]; then
rm /tmp/nextcloud-force-initialization
fi
echo "Initializing finished" echo "Initializing finished"
fi fi