0
0
Fork 0
mirror of https://github.com/nextcloud/docker.git synced 2025-07-18 13:38:05 +02:00

Compare commits

..

5 commits

Author SHA1 Message Date
jessebot
e35ea1e23b
only set variables if they're actively in use
Signed-off-by: jessebot <jessebot@linux.com>
2025-01-09 14:44:06 +01:00
Jesse Hitch
1581991664 Update README.md
Signed-off-by: Jesse Hitch <jessebot@linux.com>
2025-01-02 17:19:03 +01:00
Jesse Hitch
290d81f07b Update README.md
Signed-off-by: Jesse Hitch <jessebot@linux.com>
2025-01-02 17:19:03 +01:00
Jesse Hitch
f925ce2306 Update .config/s3.config.php - don't set defaults for new s3 values
Signed-off-by: Jesse Hitch <jessebot@linux.com>
2025-01-02 17:19:03 +01:00
jessebot
61fda52036 allow setting s3 concurrency, proxy, timeout, uploadPartSize, putSizeLimit, version, and verify_bucket_exists
Signed-off-by: jessebot <jessebot@linux.com>
2025-01-02 17:19:03 +01:00
78 changed files with 303 additions and 675 deletions

View file

@ -14,8 +14,4 @@ if (getenv('REDIS_HOST')) {
} elseif (getenv('REDIS_HOST')[0] != '/') { } elseif (getenv('REDIS_HOST')[0] != '/') {
$CONFIG['redis']['port'] = 6379; $CONFIG['redis']['port'] = 6379;
} }
if (getenv('REDIS_HOST_USER') !== false) {
$CONFIG['redis']['user'] = (string) getenv('REDIS_HOST_USER');
}
} }

View file

@ -1,7 +1,7 @@
services: services:
db: db:
image: mariadb:10.11 image: mariadb:10.11
command: --transaction-isolation=READ-COMMITTED command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW
restart: always restart: always
volumes: volumes:
- db:/var/lib/mysql:Z - db:/var/lib/mysql:Z

View file

@ -1,7 +1,7 @@
services: services:
db: db:
image: mariadb:10.11 image: mariadb:10.11
command: --transaction-isolation=READ-COMMITTED command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW
restart: always restart: always
volumes: volumes:
- db:/var/lib/mysql:Z - db:/var/lib/mysql:Z

View file

@ -183,7 +183,7 @@ http {
} }
} }
location ~ \.(otf|woff2?)$ { location ~ \.woff2?$ {
try_files $uri /index.php$request_uri; try_files $uri /index.php$request_uri;
expires 7d; # Cache-Control policy borrowed from `.htaccess` expires 7d; # Cache-Control policy borrowed from `.htaccess`
access_log off; # Optional: Don't log access to assets access_log off; # Optional: Don't log access to assets

View file

@ -183,7 +183,7 @@ http {
} }
} }
location ~ \.(otf|woff2?)$ { location ~ \.woff2?$ {
try_files $uri /index.php$request_uri; try_files $uri /index.php$request_uri;
expires 7d; # Cache-Control policy borrowed from `.htaccess` expires 7d; # Cache-Control policy borrowed from `.htaccess`
access_log off; # Optional: Don't log access to assets access_log off; # Optional: Don't log access to assets

View file

@ -1,7 +1,7 @@
services: services:
db: db:
image: mariadb:10.11 image: mariadb:10.11
command: --transaction-isolation=READ-COMMITTED command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW
restart: always restart: always
volumes: volumes:
- db:/var/lib/mysql:Z - db:/var/lib/mysql:Z

View file

@ -1,7 +1,7 @@
services: services:
db: db:
image: mariadb:10.11 image: mariadb:10.11
command: --transaction-isolation=READ-COMMITTED command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW
restart: always restart: always
volumes: volumes:
- db:/var/lib/mysql:Z - db:/var/lib/mysql:Z

View file

@ -183,7 +183,7 @@ http {
} }
} }
location ~ \.(otf|woff2?)$ { location ~ \.woff2?$ {
try_files $uri /index.php$request_uri; try_files $uri /index.php$request_uri;
expires 7d; # Cache-Control policy borrowed from `.htaccess` expires 7d; # Cache-Control policy borrowed from `.htaccess`
access_log off; # Optional: Don't log access to assets access_log off; # Optional: Don't log access to assets

View file

@ -183,7 +183,7 @@ http {
} }
} }
location ~ \.(otf|woff2?)$ { location ~ \.woff2?$ {
try_files $uri /index.php$request_uri; try_files $uri /index.php$request_uri;
expires 7d; # Cache-Control policy borrowed from `.htaccess` expires 7d; # Cache-Control policy borrowed from `.htaccess`
access_log off; # Optional: Don't log access to assets access_log off; # Optional: Don't log access to assets

View file

@ -1,15 +0,0 @@
---
name: 🚀 Suggest an enhancement
about: Suggest an idea for improving the image
labels: "enhancement, 0. Needs triage"
---
<!--
Thanks for suggesting an idea to improve the Nextcloud Docker image!
This image is maintained by volunteers so if you're able to assist with implementing your idea, please mention that (and consider submitting a PR as well).
Note: This is the issue tracker of the official Nextcloud **Docker image**, please do NOT use this to suggestion enhancements in Nextcloud Server itself.
To learn more about official images, see https://github.com/docker-library/faq
-->

View file

@ -1,7 +1,6 @@
--- ---
name: 🐛 Report a bug in the image name: 🐛 Image issue
about: Create a report to help us improve the image about: Issues related to the Nextcloud Docker image
labels: "bug, 0. Needs triage"
--- ---
<!-- <!--

View file

@ -1,22 +1,10 @@
contact_links: contact_links:
- name: ❓ Ask a question - name: 🐛 Nextcloud issue
url: https://help.nextcloud.com/ url: https://github.com/nextcloud/server/issues/new/choose
about: Ask a question, get assistance or start a discussion regarding Nextcloud and/or this image about: Bug reports and feature requests for Nextcloud
- name: Documentation - Nextcloud Server - name: 🐳 Docker Support and Help
url: https://docs.nextcloud.com/
about: Official documentation for Nextcloud Server
- name: Documentation - Nextcloud Docker Image
url: https://github.com/nextcloud/docker/blob/master/README.md
about: Official documentation for this image
- name: 🐳 Documentation - Docker
url: https://docs.docker.com/
about: Official documentation for Docker (installing, configuring, troubleshooting)
- name: 🐳 Docker Forum
url: https://forums.docker.com/ url: https://forums.docker.com/
about: Ask a question, get assistance or start a discussion regarding Docker about: Configuration, installation, networking and other questions
- name: 🐛 Bug Report - Nextcloud Server - name: ❓ Nextcloud Support and Help
url: https://github.com/nextcloud/server/issues/new/choose url: https://help.nextcloud.com/
about: Report a bug in Nextcloud Server about: Configuration, webserver/proxy or performance issues and other questions
- name: Enhancement Idea - Nextcloud Server
url: https://github.com/nextcloud/server/issues/new/choose
about: Suggest an enhancement idea for Nextcloud Server

View file

@ -21,7 +21,6 @@ RUN set -ex; \
# see https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html # see https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html
ENV PHP_MEMORY_LIMIT 512M ENV PHP_MEMORY_LIMIT 512M
ENV PHP_UPLOAD_LIMIT 512M ENV PHP_UPLOAD_LIMIT 512M
ENV PHP_OPCACHE_MEMORY_CONSUMPTION 128
RUN set -ex; \ RUN set -ex; \
\ \
savedAptMark="$(apt-mark showmanual)"; \ savedAptMark="$(apt-mark showmanual)"; \
@ -67,16 +66,12 @@ RUN set -ex; \
\ \
# pecl will claim success even if one install fails, so we need to perform each install separately # pecl will claim success even if one install fails, so we need to perform each install separately
pecl install APCu-5.1.24; \ pecl install APCu-5.1.24; \
pecl install igbinary-3.2.16; \ pecl install imagick-3.7.0; \
pecl install imagick-3.8.0; \ pecl install memcached-3.3.0; \
pecl install memcached-3.3.0 \ pecl install redis-6.1.0; \
--configureoptions 'enable-memcached-igbinary="yes"'; \
pecl install redis-6.2.0 \
--configureoptions 'enable-redis-igbinary="yes" enable-redis-zstd="yes" enable-redis-lz4="yes"'; \
\ \
docker-php-ext-enable \ docker-php-ext-enable \
apcu \ apcu \
igbinary \
imagick \ imagick \
memcached \ memcached \
redis \ redis \
@ -103,20 +98,15 @@ RUN { \
echo 'opcache.enable=1'; \ echo 'opcache.enable=1'; \
echo 'opcache.interned_strings_buffer=32'; \ echo 'opcache.interned_strings_buffer=32'; \
echo 'opcache.max_accelerated_files=10000'; \ echo 'opcache.max_accelerated_files=10000'; \
echo 'opcache.memory_consumption=${PHP_OPCACHE_MEMORY_CONSUMPTION}'; \ echo 'opcache.memory_consumption=128'; \
echo 'opcache.save_comments=1'; \ echo 'opcache.save_comments=1'; \
echo 'opcache.revalidate_freq=60'; \ echo 'opcache.revalidate_freq=60'; \
echo 'opcache.jit=1255'; \ echo 'opcache.jit=1255'; \
echo 'opcache.jit_buffer_size=8M'; \ echo 'opcache.jit_buffer_size=128M'; \
} > "${PHP_INI_DIR}/conf.d/opcache-recommended.ini"; \ } > "${PHP_INI_DIR}/conf.d/opcache-recommended.ini"; \
\ \
echo 'apc.enable_cli=1' >> "${PHP_INI_DIR}/conf.d/docker-php-ext-apcu.ini"; \ echo 'apc.enable_cli=1' >> "${PHP_INI_DIR}/conf.d/docker-php-ext-apcu.ini"; \
\ \
{ \
echo 'apc.serializer=igbinary'; \
echo 'session.serialize_handler=igbinary'; \
} >> "${PHP_INI_DIR}/conf.d/docker-php-ext-igbinary.ini"; \
\
{ \ { \
echo 'memory_limit=${PHP_MEMORY_LIMIT}'; \ echo 'memory_limit=${PHP_MEMORY_LIMIT}'; \
echo 'upload_max_filesize=${PHP_UPLOAD_LIMIT}'; \ echo 'upload_max_filesize=${PHP_UPLOAD_LIMIT}'; \
@ -150,7 +140,7 @@ RUN { \
} > /etc/apache2/conf-available/apache-limits.conf; \ } > /etc/apache2/conf-available/apache-limits.conf; \
a2enconf apache-limits a2enconf apache-limits
ENV NEXTCLOUD_VERSION 31.0.4 ENV NEXTCLOUD_VERSION 28.0.14
RUN set -ex; \ RUN set -ex; \
fetchDeps=" \ fetchDeps=" \
@ -160,8 +150,8 @@ RUN set -ex; \
apt-get update; \ apt-get update; \
apt-get install -y --no-install-recommends $fetchDeps; \ apt-get install -y --no-install-recommends $fetchDeps; \
\ \
curl -fsSL -o nextcloud.tar.bz2 "https://download.nextcloud.com/server/releases/nextcloud-31.0.4.tar.bz2"; \ curl -fsSL -o nextcloud.tar.bz2 "https://download.nextcloud.com/server/releases/nextcloud-28.0.14.tar.bz2"; \
curl -fsSL -o nextcloud.tar.bz2.asc "https://download.nextcloud.com/server/releases/nextcloud-31.0.4.tar.bz2.asc"; \ curl -fsSL -o nextcloud.tar.bz2.asc "https://download.nextcloud.com/server/releases/nextcloud-28.0.14.tar.bz2.asc"; \
export GNUPGHOME="$(mktemp -d)"; \ export GNUPGHOME="$(mktemp -d)"; \
# gpg key from https://nextcloud.com/nextcloud.asc # gpg key from https://nextcloud.com/nextcloud.asc
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \

View file

@ -14,8 +14,4 @@ if (getenv('REDIS_HOST')) {
} elseif (getenv('REDIS_HOST')[0] != '/') { } elseif (getenv('REDIS_HOST')[0] != '/') {
$CONFIG['redis']['port'] = 6379; $CONFIG['redis']['port'] = 6379;
} }
if (getenv('REDIS_HOST_USER') !== false) {
$CONFIG['redis']['user'] = (string) getenv('REDIS_HOST_USER');
}
} }

View file

@ -23,39 +23,32 @@ run_as() {
run_path() { run_path() {
local hook_folder_path="/docker-entrypoint-hooks.d/$1" local hook_folder_path="/docker-entrypoint-hooks.d/$1"
local return_code=0 local return_code=0
local found=0
echo "=> Searching for hook scripts (*.sh) to run, located in the folder \"${hook_folder_path}\"" if ! [ -d "${hook_folder_path}" ]; then
echo "=> Skipping the folder \"${hook_folder_path}\", because it doesn't exist"
if ! [ -d "${hook_folder_path}" ] || directory_empty "${hook_folder_path}"; then
echo "==> Skipped: the \"$1\" folder is empty (or does not exist)"
return 0 return 0
fi fi
find "${hook_folder_path}" -maxdepth 1 -iname '*.sh' '(' -type f -o -type l ')' -print | sort | ( echo "=> Searching for scripts (*.sh) to run, located in the folder: ${hook_folder_path}"
while read -r script_file_path; do
(
find "${hook_folder_path}" -maxdepth 1 -iname '*.sh' '(' -type f -o -type l ')' -print | sort | while read -r script_file_path; do
if ! [ -x "${script_file_path}" ]; then if ! [ -x "${script_file_path}" ]; then
echo "==> The script \"${script_file_path}\" was skipped, because it lacks the executable flag" echo "==> The script \"${script_file_path}\" was skipped, because it didn't have the executable flag"
found=$((found-1))
continue continue
fi fi
echo "==> Running the script (cwd: $(pwd)): \"${script_file_path}\"" echo "==> Running the script (cwd: $(pwd)): \"${script_file_path}\""
found=$((found+1))
run_as "${script_file_path}" || return_code="$?" run_as "${script_file_path}" || return_code="$?"
if [ "${return_code}" -ne "0" ]; then if [ "${return_code}" -ne "0" ]; then
echo "==> Failed at executing script \"${script_file_path}\". Exit code: ${return_code}" echo "==> Failed at executing \"${script_file_path}\". Exit code: ${return_code}"
exit 1 exit 1
fi fi
echo "==> Finished executing the script: \"${script_file_path}\"" echo "==> Finished the script: \"${script_file_path}\""
done done
if [ "$found" -lt "1" ]; then
echo "==> Skipped: the \"$1\" folder does not contain any valid scripts"
else
echo "=> Completed executing scripts in the \"$1\" folder"
fi
) )
} }
@ -121,21 +114,13 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
# check if redis host is an unix socket path # check if redis host is an unix socket path
if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then
if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
if [ -n "${REDIS_HOST_USER+x}" ]; then
echo "session.save_path = \"unix://${REDIS_HOST}?auth[]=${REDIS_HOST_USER}&auth[]=${REDIS_HOST_PASSWORD}\""
else
echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_HOST_PASSWORD}\"" echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_HOST_PASSWORD}\""
fi
else else
echo "session.save_path = \"unix://${REDIS_HOST}\"" echo "session.save_path = \"unix://${REDIS_HOST}\""
fi fi
# check if redis password has been set # check if redis password has been set
elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
if [ -n "${REDIS_HOST_USER+x}" ]; then
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth[]=${REDIS_HOST_USER}&auth[]=${REDIS_HOST_PASSWORD}\""
else
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\""
fi
else else
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\""
fi fi
@ -252,14 +237,12 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
fi fi
if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then
echo "Setting trusted domains…" echo "Setting trusted domains…"
set -f # turn off glob
NC_TRUSTED_DOMAIN_IDX=1 NC_TRUSTED_DOMAIN_IDX=1
for DOMAIN in ${NEXTCLOUD_TRUSTED_DOMAINS}; do for DOMAIN in $NEXTCLOUD_TRUSTED_DOMAINS ; do
DOMAIN=$(echo "${DOMAIN}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') DOMAIN=$(echo "$DOMAIN" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=\"${DOMAIN}\"" run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=$DOMAIN"
NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1)) NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1))
done done
set +f # turn glob back on
fi fi
run_path post-installation run_path post-installation

View file

@ -1,5 +1,5 @@
# DO NOT EDIT: created by update.sh from Dockerfile-alpine.template # DO NOT EDIT: created by update.sh from Dockerfile-alpine.template
FROM php:8.2-fpm-alpine3.21 FROM php:8.2-fpm-alpine3.20
# entrypoint.sh and cron.sh dependencies # entrypoint.sh and cron.sh dependencies
RUN set -ex; \ RUN set -ex; \
@ -64,16 +64,12 @@ RUN set -ex; \
\ \
# pecl will claim success even if one install fails, so we need to perform each install separately # pecl will claim success even if one install fails, so we need to perform each install separately
pecl install APCu-5.1.24; \ pecl install APCu-5.1.24; \
pecl install igbinary-3.2.16; \ pecl install imagick-3.7.0; \
pecl install imagick-3.8.0; \ pecl install memcached-3.3.0; \
pecl install memcached-3.3.0 \ pecl install redis-6.1.0; \
--configureoptions 'enable-memcached-igbinary="yes"'; \
pecl install redis-6.2.0 \
--configureoptions 'enable-redis-igbinary="yes" enable-redis-zstd="yes" enable-redis-lz4="yes"'; \
\ \
docker-php-ext-enable \ docker-php-ext-enable \
apcu \ apcu \
igbinary \
imagick \ imagick \
memcached \ memcached \
redis \ redis \
@ -93,25 +89,19 @@ RUN set -ex; \
# see https://docs.nextcloud.com/server/latest/admin_manual/installation/server_tuning.html#enable-php-opcache # see https://docs.nextcloud.com/server/latest/admin_manual/installation/server_tuning.html#enable-php-opcache
ENV PHP_MEMORY_LIMIT 512M ENV PHP_MEMORY_LIMIT 512M
ENV PHP_UPLOAD_LIMIT 512M ENV PHP_UPLOAD_LIMIT 512M
ENV PHP_OPCACHE_MEMORY_CONSUMPTION 128
RUN { \ RUN { \
echo 'opcache.enable=1'; \ echo 'opcache.enable=1'; \
echo 'opcache.interned_strings_buffer=32'; \ echo 'opcache.interned_strings_buffer=32'; \
echo 'opcache.max_accelerated_files=10000'; \ echo 'opcache.max_accelerated_files=10000'; \
echo 'opcache.memory_consumption=${PHP_OPCACHE_MEMORY_CONSUMPTION}'; \ echo 'opcache.memory_consumption=128'; \
echo 'opcache.save_comments=1'; \ echo 'opcache.save_comments=1'; \
echo 'opcache.revalidate_freq=60'; \ echo 'opcache.revalidate_freq=60'; \
echo 'opcache.jit=1255'; \ echo 'opcache.jit=1255'; \
echo 'opcache.jit_buffer_size=8M'; \ echo 'opcache.jit_buffer_size=128M'; \
} > "${PHP_INI_DIR}/conf.d/opcache-recommended.ini"; \ } > "${PHP_INI_DIR}/conf.d/opcache-recommended.ini"; \
\ \
echo 'apc.enable_cli=1' >> "${PHP_INI_DIR}/conf.d/docker-php-ext-apcu.ini"; \ echo 'apc.enable_cli=1' >> "${PHP_INI_DIR}/conf.d/docker-php-ext-apcu.ini"; \
\ \
{ \
echo 'apc.serializer=igbinary'; \
echo 'session.serialize_handler=igbinary'; \
} >> "${PHP_INI_DIR}/conf.d/docker-php-ext-igbinary.ini"; \
\
{ \ { \
echo 'memory_limit=${PHP_MEMORY_LIMIT}'; \ echo 'memory_limit=${PHP_MEMORY_LIMIT}'; \
echo 'upload_max_filesize=${PHP_UPLOAD_LIMIT}'; \ echo 'upload_max_filesize=${PHP_UPLOAD_LIMIT}'; \
@ -130,7 +120,7 @@ RUN { \
VOLUME /var/www/html VOLUME /var/www/html
ENV NEXTCLOUD_VERSION 31.0.4 ENV NEXTCLOUD_VERSION 28.0.14
RUN set -ex; \ RUN set -ex; \
apk add --no-cache --virtual .fetch-deps \ apk add --no-cache --virtual .fetch-deps \
@ -138,8 +128,8 @@ RUN set -ex; \
gnupg \ gnupg \
; \ ; \
\ \
curl -fsSL -o nextcloud.tar.bz2 "https://download.nextcloud.com/server/releases/nextcloud-31.0.4.tar.bz2"; \ curl -fsSL -o nextcloud.tar.bz2 "https://download.nextcloud.com/server/releases/nextcloud-28.0.14.tar.bz2"; \
curl -fsSL -o nextcloud.tar.bz2.asc "https://download.nextcloud.com/server/releases/nextcloud-31.0.4.tar.bz2.asc"; \ curl -fsSL -o nextcloud.tar.bz2.asc "https://download.nextcloud.com/server/releases/nextcloud-28.0.14.tar.bz2.asc"; \
export GNUPGHOME="$(mktemp -d)"; \ export GNUPGHOME="$(mktemp -d)"; \
# gpg key from https://nextcloud.com/nextcloud.asc # gpg key from https://nextcloud.com/nextcloud.asc
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \

View file

@ -14,8 +14,4 @@ if (getenv('REDIS_HOST')) {
} elseif (getenv('REDIS_HOST')[0] != '/') { } elseif (getenv('REDIS_HOST')[0] != '/') {
$CONFIG['redis']['port'] = 6379; $CONFIG['redis']['port'] = 6379;
} }
if (getenv('REDIS_HOST_USER') !== false) {
$CONFIG['redis']['user'] = (string) getenv('REDIS_HOST_USER');
}
} }

View file

@ -23,39 +23,32 @@ run_as() {
run_path() { run_path() {
local hook_folder_path="/docker-entrypoint-hooks.d/$1" local hook_folder_path="/docker-entrypoint-hooks.d/$1"
local return_code=0 local return_code=0
local found=0
echo "=> Searching for hook scripts (*.sh) to run, located in the folder \"${hook_folder_path}\"" if ! [ -d "${hook_folder_path}" ]; then
echo "=> Skipping the folder \"${hook_folder_path}\", because it doesn't exist"
if ! [ -d "${hook_folder_path}" ] || directory_empty "${hook_folder_path}"; then
echo "==> Skipped: the \"$1\" folder is empty (or does not exist)"
return 0 return 0
fi fi
find "${hook_folder_path}" -maxdepth 1 -iname '*.sh' '(' -type f -o -type l ')' -print | sort | ( echo "=> Searching for scripts (*.sh) to run, located in the folder: ${hook_folder_path}"
while read -r script_file_path; do
(
find "${hook_folder_path}" -maxdepth 1 -iname '*.sh' '(' -type f -o -type l ')' -print | sort | while read -r script_file_path; do
if ! [ -x "${script_file_path}" ]; then if ! [ -x "${script_file_path}" ]; then
echo "==> The script \"${script_file_path}\" was skipped, because it lacks the executable flag" echo "==> The script \"${script_file_path}\" was skipped, because it didn't have the executable flag"
found=$((found-1))
continue continue
fi fi
echo "==> Running the script (cwd: $(pwd)): \"${script_file_path}\"" echo "==> Running the script (cwd: $(pwd)): \"${script_file_path}\""
found=$((found+1))
run_as "${script_file_path}" || return_code="$?" run_as "${script_file_path}" || return_code="$?"
if [ "${return_code}" -ne "0" ]; then if [ "${return_code}" -ne "0" ]; then
echo "==> Failed at executing script \"${script_file_path}\". Exit code: ${return_code}" echo "==> Failed at executing \"${script_file_path}\". Exit code: ${return_code}"
exit 1 exit 1
fi fi
echo "==> Finished executing the script: \"${script_file_path}\"" echo "==> Finished the script: \"${script_file_path}\""
done done
if [ "$found" -lt "1" ]; then
echo "==> Skipped: the \"$1\" folder does not contain any valid scripts"
else
echo "=> Completed executing scripts in the \"$1\" folder"
fi
) )
} }
@ -121,21 +114,13 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
# check if redis host is an unix socket path # check if redis host is an unix socket path
if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then
if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
if [ -n "${REDIS_HOST_USER+x}" ]; then
echo "session.save_path = \"unix://${REDIS_HOST}?auth[]=${REDIS_HOST_USER}&auth[]=${REDIS_HOST_PASSWORD}\""
else
echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_HOST_PASSWORD}\"" echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_HOST_PASSWORD}\""
fi
else else
echo "session.save_path = \"unix://${REDIS_HOST}\"" echo "session.save_path = \"unix://${REDIS_HOST}\""
fi fi
# check if redis password has been set # check if redis password has been set
elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
if [ -n "${REDIS_HOST_USER+x}" ]; then
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth[]=${REDIS_HOST_USER}&auth[]=${REDIS_HOST_PASSWORD}\""
else
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\""
fi
else else
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\""
fi fi
@ -252,14 +237,12 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
fi fi
if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then
echo "Setting trusted domains…" echo "Setting trusted domains…"
set -f # turn off glob
NC_TRUSTED_DOMAIN_IDX=1 NC_TRUSTED_DOMAIN_IDX=1
for DOMAIN in ${NEXTCLOUD_TRUSTED_DOMAINS}; do for DOMAIN in $NEXTCLOUD_TRUSTED_DOMAINS ; do
DOMAIN=$(echo "${DOMAIN}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') DOMAIN=$(echo "$DOMAIN" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=\"${DOMAIN}\"" run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=$DOMAIN"
NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1)) NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1))
done done
set +f # turn glob back on
fi fi
run_path post-installation run_path post-installation

View file

@ -21,7 +21,6 @@ RUN set -ex; \
# see https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html # see https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html
ENV PHP_MEMORY_LIMIT 512M ENV PHP_MEMORY_LIMIT 512M
ENV PHP_UPLOAD_LIMIT 512M ENV PHP_UPLOAD_LIMIT 512M
ENV PHP_OPCACHE_MEMORY_CONSUMPTION 128
RUN set -ex; \ RUN set -ex; \
\ \
savedAptMark="$(apt-mark showmanual)"; \ savedAptMark="$(apt-mark showmanual)"; \
@ -67,16 +66,12 @@ RUN set -ex; \
\ \
# pecl will claim success even if one install fails, so we need to perform each install separately # pecl will claim success even if one install fails, so we need to perform each install separately
pecl install APCu-5.1.24; \ pecl install APCu-5.1.24; \
pecl install igbinary-3.2.16; \ pecl install imagick-3.7.0; \
pecl install imagick-3.8.0; \ pecl install memcached-3.3.0; \
pecl install memcached-3.3.0 \ pecl install redis-6.1.0; \
--configureoptions 'enable-memcached-igbinary="yes"'; \
pecl install redis-6.2.0 \
--configureoptions 'enable-redis-igbinary="yes" enable-redis-zstd="yes" enable-redis-lz4="yes"'; \
\ \
docker-php-ext-enable \ docker-php-ext-enable \
apcu \ apcu \
igbinary \
imagick \ imagick \
memcached \ memcached \
redis \ redis \
@ -103,20 +98,15 @@ RUN { \
echo 'opcache.enable=1'; \ echo 'opcache.enable=1'; \
echo 'opcache.interned_strings_buffer=32'; \ echo 'opcache.interned_strings_buffer=32'; \
echo 'opcache.max_accelerated_files=10000'; \ echo 'opcache.max_accelerated_files=10000'; \
echo 'opcache.memory_consumption=${PHP_OPCACHE_MEMORY_CONSUMPTION}'; \ echo 'opcache.memory_consumption=128'; \
echo 'opcache.save_comments=1'; \ echo 'opcache.save_comments=1'; \
echo 'opcache.revalidate_freq=60'; \ echo 'opcache.revalidate_freq=60'; \
echo 'opcache.jit=1255'; \ echo 'opcache.jit=1255'; \
echo 'opcache.jit_buffer_size=8M'; \ echo 'opcache.jit_buffer_size=128M'; \
} > "${PHP_INI_DIR}/conf.d/opcache-recommended.ini"; \ } > "${PHP_INI_DIR}/conf.d/opcache-recommended.ini"; \
\ \
echo 'apc.enable_cli=1' >> "${PHP_INI_DIR}/conf.d/docker-php-ext-apcu.ini"; \ echo 'apc.enable_cli=1' >> "${PHP_INI_DIR}/conf.d/docker-php-ext-apcu.ini"; \
\ \
{ \
echo 'apc.serializer=igbinary'; \
echo 'session.serialize_handler=igbinary'; \
} >> "${PHP_INI_DIR}/conf.d/docker-php-ext-igbinary.ini"; \
\
{ \ { \
echo 'memory_limit=${PHP_MEMORY_LIMIT}'; \ echo 'memory_limit=${PHP_MEMORY_LIMIT}'; \
echo 'upload_max_filesize=${PHP_UPLOAD_LIMIT}'; \ echo 'upload_max_filesize=${PHP_UPLOAD_LIMIT}'; \
@ -135,7 +125,7 @@ RUN { \
VOLUME /var/www/html VOLUME /var/www/html
ENV NEXTCLOUD_VERSION 31.0.4 ENV NEXTCLOUD_VERSION 28.0.14
RUN set -ex; \ RUN set -ex; \
fetchDeps=" \ fetchDeps=" \
@ -145,8 +135,8 @@ RUN set -ex; \
apt-get update; \ apt-get update; \
apt-get install -y --no-install-recommends $fetchDeps; \ apt-get install -y --no-install-recommends $fetchDeps; \
\ \
curl -fsSL -o nextcloud.tar.bz2 "https://download.nextcloud.com/server/releases/nextcloud-31.0.4.tar.bz2"; \ curl -fsSL -o nextcloud.tar.bz2 "https://download.nextcloud.com/server/releases/nextcloud-28.0.14.tar.bz2"; \
curl -fsSL -o nextcloud.tar.bz2.asc "https://download.nextcloud.com/server/releases/nextcloud-31.0.4.tar.bz2.asc"; \ curl -fsSL -o nextcloud.tar.bz2.asc "https://download.nextcloud.com/server/releases/nextcloud-28.0.14.tar.bz2.asc"; \
export GNUPGHOME="$(mktemp -d)"; \ export GNUPGHOME="$(mktemp -d)"; \
# gpg key from https://nextcloud.com/nextcloud.asc # gpg key from https://nextcloud.com/nextcloud.asc
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \

View file

@ -14,8 +14,4 @@ if (getenv('REDIS_HOST')) {
} elseif (getenv('REDIS_HOST')[0] != '/') { } elseif (getenv('REDIS_HOST')[0] != '/') {
$CONFIG['redis']['port'] = 6379; $CONFIG['redis']['port'] = 6379;
} }
if (getenv('REDIS_HOST_USER') !== false) {
$CONFIG['redis']['user'] = (string) getenv('REDIS_HOST_USER');
}
} }

View file

@ -23,39 +23,32 @@ run_as() {
run_path() { run_path() {
local hook_folder_path="/docker-entrypoint-hooks.d/$1" local hook_folder_path="/docker-entrypoint-hooks.d/$1"
local return_code=0 local return_code=0
local found=0
echo "=> Searching for hook scripts (*.sh) to run, located in the folder \"${hook_folder_path}\"" if ! [ -d "${hook_folder_path}" ]; then
echo "=> Skipping the folder \"${hook_folder_path}\", because it doesn't exist"
if ! [ -d "${hook_folder_path}" ] || directory_empty "${hook_folder_path}"; then
echo "==> Skipped: the \"$1\" folder is empty (or does not exist)"
return 0 return 0
fi fi
find "${hook_folder_path}" -maxdepth 1 -iname '*.sh' '(' -type f -o -type l ')' -print | sort | ( echo "=> Searching for scripts (*.sh) to run, located in the folder: ${hook_folder_path}"
while read -r script_file_path; do
(
find "${hook_folder_path}" -maxdepth 1 -iname '*.sh' '(' -type f -o -type l ')' -print | sort | while read -r script_file_path; do
if ! [ -x "${script_file_path}" ]; then if ! [ -x "${script_file_path}" ]; then
echo "==> The script \"${script_file_path}\" was skipped, because it lacks the executable flag" echo "==> The script \"${script_file_path}\" was skipped, because it didn't have the executable flag"
found=$((found-1))
continue continue
fi fi
echo "==> Running the script (cwd: $(pwd)): \"${script_file_path}\"" echo "==> Running the script (cwd: $(pwd)): \"${script_file_path}\""
found=$((found+1))
run_as "${script_file_path}" || return_code="$?" run_as "${script_file_path}" || return_code="$?"
if [ "${return_code}" -ne "0" ]; then if [ "${return_code}" -ne "0" ]; then
echo "==> Failed at executing script \"${script_file_path}\". Exit code: ${return_code}" echo "==> Failed at executing \"${script_file_path}\". Exit code: ${return_code}"
exit 1 exit 1
fi fi
echo "==> Finished executing the script: \"${script_file_path}\"" echo "==> Finished the script: \"${script_file_path}\""
done done
if [ "$found" -lt "1" ]; then
echo "==> Skipped: the \"$1\" folder does not contain any valid scripts"
else
echo "=> Completed executing scripts in the \"$1\" folder"
fi
) )
} }
@ -121,21 +114,13 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
# check if redis host is an unix socket path # check if redis host is an unix socket path
if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then
if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
if [ -n "${REDIS_HOST_USER+x}" ]; then
echo "session.save_path = \"unix://${REDIS_HOST}?auth[]=${REDIS_HOST_USER}&auth[]=${REDIS_HOST_PASSWORD}\""
else
echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_HOST_PASSWORD}\"" echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_HOST_PASSWORD}\""
fi
else else
echo "session.save_path = \"unix://${REDIS_HOST}\"" echo "session.save_path = \"unix://${REDIS_HOST}\""
fi fi
# check if redis password has been set # check if redis password has been set
elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
if [ -n "${REDIS_HOST_USER+x}" ]; then
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth[]=${REDIS_HOST_USER}&auth[]=${REDIS_HOST_PASSWORD}\""
else
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\""
fi
else else
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\""
fi fi
@ -252,14 +237,12 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
fi fi
if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then
echo "Setting trusted domains…" echo "Setting trusted domains…"
set -f # turn off glob
NC_TRUSTED_DOMAIN_IDX=1 NC_TRUSTED_DOMAIN_IDX=1
for DOMAIN in ${NEXTCLOUD_TRUSTED_DOMAINS}; do for DOMAIN in $NEXTCLOUD_TRUSTED_DOMAINS ; do
DOMAIN=$(echo "${DOMAIN}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') DOMAIN=$(echo "$DOMAIN" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=\"${DOMAIN}\"" run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=$DOMAIN"
NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1)) NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1))
done done
set +f # turn glob back on
fi fi
run_path post-installation run_path post-installation

View file

@ -21,7 +21,6 @@ RUN set -ex; \
# see https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html # see https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html
ENV PHP_MEMORY_LIMIT 512M ENV PHP_MEMORY_LIMIT 512M
ENV PHP_UPLOAD_LIMIT 512M ENV PHP_UPLOAD_LIMIT 512M
ENV PHP_OPCACHE_MEMORY_CONSUMPTION 128
RUN set -ex; \ RUN set -ex; \
\ \
savedAptMark="$(apt-mark showmanual)"; \ savedAptMark="$(apt-mark showmanual)"; \
@ -67,16 +66,12 @@ RUN set -ex; \
\ \
# pecl will claim success even if one install fails, so we need to perform each install separately # pecl will claim success even if one install fails, so we need to perform each install separately
pecl install APCu-5.1.24; \ pecl install APCu-5.1.24; \
pecl install igbinary-3.2.16; \ pecl install imagick-3.7.0; \
pecl install imagick-3.8.0; \ pecl install memcached-3.3.0; \
pecl install memcached-3.3.0 \ pecl install redis-6.1.0; \
--configureoptions 'enable-memcached-igbinary="yes"'; \
pecl install redis-6.2.0 \
--configureoptions 'enable-redis-igbinary="yes" enable-redis-zstd="yes" enable-redis-lz4="yes"'; \
\ \
docker-php-ext-enable \ docker-php-ext-enable \
apcu \ apcu \
igbinary \
imagick \ imagick \
memcached \ memcached \
redis \ redis \
@ -103,20 +98,15 @@ RUN { \
echo 'opcache.enable=1'; \ echo 'opcache.enable=1'; \
echo 'opcache.interned_strings_buffer=32'; \ echo 'opcache.interned_strings_buffer=32'; \
echo 'opcache.max_accelerated_files=10000'; \ echo 'opcache.max_accelerated_files=10000'; \
echo 'opcache.memory_consumption=${PHP_OPCACHE_MEMORY_CONSUMPTION}'; \ echo 'opcache.memory_consumption=128'; \
echo 'opcache.save_comments=1'; \ echo 'opcache.save_comments=1'; \
echo 'opcache.revalidate_freq=60'; \ echo 'opcache.revalidate_freq=60'; \
echo 'opcache.jit=1255'; \ echo 'opcache.jit=1255'; \
echo 'opcache.jit_buffer_size=8M'; \ echo 'opcache.jit_buffer_size=128M'; \
} > "${PHP_INI_DIR}/conf.d/opcache-recommended.ini"; \ } > "${PHP_INI_DIR}/conf.d/opcache-recommended.ini"; \
\ \
echo 'apc.enable_cli=1' >> "${PHP_INI_DIR}/conf.d/docker-php-ext-apcu.ini"; \ echo 'apc.enable_cli=1' >> "${PHP_INI_DIR}/conf.d/docker-php-ext-apcu.ini"; \
\ \
{ \
echo 'apc.serializer=igbinary'; \
echo 'session.serialize_handler=igbinary'; \
} >> "${PHP_INI_DIR}/conf.d/docker-php-ext-igbinary.ini"; \
\
{ \ { \
echo 'memory_limit=${PHP_MEMORY_LIMIT}'; \ echo 'memory_limit=${PHP_MEMORY_LIMIT}'; \
echo 'upload_max_filesize=${PHP_UPLOAD_LIMIT}'; \ echo 'upload_max_filesize=${PHP_UPLOAD_LIMIT}'; \
@ -150,7 +140,7 @@ RUN { \
} > /etc/apache2/conf-available/apache-limits.conf; \ } > /etc/apache2/conf-available/apache-limits.conf; \
a2enconf apache-limits a2enconf apache-limits
ENV NEXTCLOUD_VERSION 29.0.16 ENV NEXTCLOUD_VERSION 29.0.10
RUN set -ex; \ RUN set -ex; \
fetchDeps=" \ fetchDeps=" \
@ -160,8 +150,8 @@ RUN set -ex; \
apt-get update; \ apt-get update; \
apt-get install -y --no-install-recommends $fetchDeps; \ apt-get install -y --no-install-recommends $fetchDeps; \
\ \
curl -fsSL -o nextcloud.tar.bz2 "https://download.nextcloud.com/server/releases/nextcloud-29.0.16.tar.bz2"; \ curl -fsSL -o nextcloud.tar.bz2 "https://download.nextcloud.com/server/releases/nextcloud-29.0.10.tar.bz2"; \
curl -fsSL -o nextcloud.tar.bz2.asc "https://download.nextcloud.com/server/releases/nextcloud-29.0.16.tar.bz2.asc"; \ curl -fsSL -o nextcloud.tar.bz2.asc "https://download.nextcloud.com/server/releases/nextcloud-29.0.10.tar.bz2.asc"; \
export GNUPGHOME="$(mktemp -d)"; \ export GNUPGHOME="$(mktemp -d)"; \
# gpg key from https://nextcloud.com/nextcloud.asc # gpg key from https://nextcloud.com/nextcloud.asc
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \

View file

@ -14,8 +14,4 @@ if (getenv('REDIS_HOST')) {
} elseif (getenv('REDIS_HOST')[0] != '/') { } elseif (getenv('REDIS_HOST')[0] != '/') {
$CONFIG['redis']['port'] = 6379; $CONFIG['redis']['port'] = 6379;
} }
if (getenv('REDIS_HOST_USER') !== false) {
$CONFIG['redis']['user'] = (string) getenv('REDIS_HOST_USER');
}
} }

View file

@ -23,39 +23,32 @@ run_as() {
run_path() { run_path() {
local hook_folder_path="/docker-entrypoint-hooks.d/$1" local hook_folder_path="/docker-entrypoint-hooks.d/$1"
local return_code=0 local return_code=0
local found=0
echo "=> Searching for hook scripts (*.sh) to run, located in the folder \"${hook_folder_path}\"" if ! [ -d "${hook_folder_path}" ]; then
echo "=> Skipping the folder \"${hook_folder_path}\", because it doesn't exist"
if ! [ -d "${hook_folder_path}" ] || directory_empty "${hook_folder_path}"; then
echo "==> Skipped: the \"$1\" folder is empty (or does not exist)"
return 0 return 0
fi fi
find "${hook_folder_path}" -maxdepth 1 -iname '*.sh' '(' -type f -o -type l ')' -print | sort | ( echo "=> Searching for scripts (*.sh) to run, located in the folder: ${hook_folder_path}"
while read -r script_file_path; do
(
find "${hook_folder_path}" -maxdepth 1 -iname '*.sh' '(' -type f -o -type l ')' -print | sort | while read -r script_file_path; do
if ! [ -x "${script_file_path}" ]; then if ! [ -x "${script_file_path}" ]; then
echo "==> The script \"${script_file_path}\" was skipped, because it lacks the executable flag" echo "==> The script \"${script_file_path}\" was skipped, because it didn't have the executable flag"
found=$((found-1))
continue continue
fi fi
echo "==> Running the script (cwd: $(pwd)): \"${script_file_path}\"" echo "==> Running the script (cwd: $(pwd)): \"${script_file_path}\""
found=$((found+1))
run_as "${script_file_path}" || return_code="$?" run_as "${script_file_path}" || return_code="$?"
if [ "${return_code}" -ne "0" ]; then if [ "${return_code}" -ne "0" ]; then
echo "==> Failed at executing script \"${script_file_path}\". Exit code: ${return_code}" echo "==> Failed at executing \"${script_file_path}\". Exit code: ${return_code}"
exit 1 exit 1
fi fi
echo "==> Finished executing the script: \"${script_file_path}\"" echo "==> Finished the script: \"${script_file_path}\""
done done
if [ "$found" -lt "1" ]; then
echo "==> Skipped: the \"$1\" folder does not contain any valid scripts"
else
echo "=> Completed executing scripts in the \"$1\" folder"
fi
) )
} }
@ -121,21 +114,13 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
# check if redis host is an unix socket path # check if redis host is an unix socket path
if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then
if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
if [ -n "${REDIS_HOST_USER+x}" ]; then
echo "session.save_path = \"unix://${REDIS_HOST}?auth[]=${REDIS_HOST_USER}&auth[]=${REDIS_HOST_PASSWORD}\""
else
echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_HOST_PASSWORD}\"" echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_HOST_PASSWORD}\""
fi
else else
echo "session.save_path = \"unix://${REDIS_HOST}\"" echo "session.save_path = \"unix://${REDIS_HOST}\""
fi fi
# check if redis password has been set # check if redis password has been set
elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
if [ -n "${REDIS_HOST_USER+x}" ]; then
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth[]=${REDIS_HOST_USER}&auth[]=${REDIS_HOST_PASSWORD}\""
else
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\""
fi
else else
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\""
fi fi
@ -252,14 +237,12 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
fi fi
if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then
echo "Setting trusted domains…" echo "Setting trusted domains…"
set -f # turn off glob
NC_TRUSTED_DOMAIN_IDX=1 NC_TRUSTED_DOMAIN_IDX=1
for DOMAIN in ${NEXTCLOUD_TRUSTED_DOMAINS}; do for DOMAIN in $NEXTCLOUD_TRUSTED_DOMAINS ; do
DOMAIN=$(echo "${DOMAIN}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') DOMAIN=$(echo "$DOMAIN" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=\"${DOMAIN}\"" run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=$DOMAIN"
NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1)) NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1))
done done
set +f # turn glob back on
fi fi
run_path post-installation run_path post-installation

View file

@ -1,5 +1,5 @@
# DO NOT EDIT: created by update.sh from Dockerfile-alpine.template # DO NOT EDIT: created by update.sh from Dockerfile-alpine.template
FROM php:8.2-fpm-alpine3.21 FROM php:8.2-fpm-alpine3.20
# entrypoint.sh and cron.sh dependencies # entrypoint.sh and cron.sh dependencies
RUN set -ex; \ RUN set -ex; \
@ -64,16 +64,12 @@ RUN set -ex; \
\ \
# pecl will claim success even if one install fails, so we need to perform each install separately # pecl will claim success even if one install fails, so we need to perform each install separately
pecl install APCu-5.1.24; \ pecl install APCu-5.1.24; \
pecl install igbinary-3.2.16; \ pecl install imagick-3.7.0; \
pecl install imagick-3.8.0; \ pecl install memcached-3.3.0; \
pecl install memcached-3.3.0 \ pecl install redis-6.1.0; \
--configureoptions 'enable-memcached-igbinary="yes"'; \
pecl install redis-6.2.0 \
--configureoptions 'enable-redis-igbinary="yes" enable-redis-zstd="yes" enable-redis-lz4="yes"'; \
\ \
docker-php-ext-enable \ docker-php-ext-enable \
apcu \ apcu \
igbinary \
imagick \ imagick \
memcached \ memcached \
redis \ redis \
@ -93,25 +89,19 @@ RUN set -ex; \
# see https://docs.nextcloud.com/server/latest/admin_manual/installation/server_tuning.html#enable-php-opcache # see https://docs.nextcloud.com/server/latest/admin_manual/installation/server_tuning.html#enable-php-opcache
ENV PHP_MEMORY_LIMIT 512M ENV PHP_MEMORY_LIMIT 512M
ENV PHP_UPLOAD_LIMIT 512M ENV PHP_UPLOAD_LIMIT 512M
ENV PHP_OPCACHE_MEMORY_CONSUMPTION 128
RUN { \ RUN { \
echo 'opcache.enable=1'; \ echo 'opcache.enable=1'; \
echo 'opcache.interned_strings_buffer=32'; \ echo 'opcache.interned_strings_buffer=32'; \
echo 'opcache.max_accelerated_files=10000'; \ echo 'opcache.max_accelerated_files=10000'; \
echo 'opcache.memory_consumption=${PHP_OPCACHE_MEMORY_CONSUMPTION}'; \ echo 'opcache.memory_consumption=128'; \
echo 'opcache.save_comments=1'; \ echo 'opcache.save_comments=1'; \
echo 'opcache.revalidate_freq=60'; \ echo 'opcache.revalidate_freq=60'; \
echo 'opcache.jit=1255'; \ echo 'opcache.jit=1255'; \
echo 'opcache.jit_buffer_size=8M'; \ echo 'opcache.jit_buffer_size=128M'; \
} > "${PHP_INI_DIR}/conf.d/opcache-recommended.ini"; \ } > "${PHP_INI_DIR}/conf.d/opcache-recommended.ini"; \
\ \
echo 'apc.enable_cli=1' >> "${PHP_INI_DIR}/conf.d/docker-php-ext-apcu.ini"; \ echo 'apc.enable_cli=1' >> "${PHP_INI_DIR}/conf.d/docker-php-ext-apcu.ini"; \
\ \
{ \
echo 'apc.serializer=igbinary'; \
echo 'session.serialize_handler=igbinary'; \
} >> "${PHP_INI_DIR}/conf.d/docker-php-ext-igbinary.ini"; \
\
{ \ { \
echo 'memory_limit=${PHP_MEMORY_LIMIT}'; \ echo 'memory_limit=${PHP_MEMORY_LIMIT}'; \
echo 'upload_max_filesize=${PHP_UPLOAD_LIMIT}'; \ echo 'upload_max_filesize=${PHP_UPLOAD_LIMIT}'; \
@ -130,7 +120,7 @@ RUN { \
VOLUME /var/www/html VOLUME /var/www/html
ENV NEXTCLOUD_VERSION 29.0.16 ENV NEXTCLOUD_VERSION 29.0.10
RUN set -ex; \ RUN set -ex; \
apk add --no-cache --virtual .fetch-deps \ apk add --no-cache --virtual .fetch-deps \
@ -138,8 +128,8 @@ RUN set -ex; \
gnupg \ gnupg \
; \ ; \
\ \
curl -fsSL -o nextcloud.tar.bz2 "https://download.nextcloud.com/server/releases/nextcloud-29.0.16.tar.bz2"; \ curl -fsSL -o nextcloud.tar.bz2 "https://download.nextcloud.com/server/releases/nextcloud-29.0.10.tar.bz2"; \
curl -fsSL -o nextcloud.tar.bz2.asc "https://download.nextcloud.com/server/releases/nextcloud-29.0.16.tar.bz2.asc"; \ curl -fsSL -o nextcloud.tar.bz2.asc "https://download.nextcloud.com/server/releases/nextcloud-29.0.10.tar.bz2.asc"; \
export GNUPGHOME="$(mktemp -d)"; \ export GNUPGHOME="$(mktemp -d)"; \
# gpg key from https://nextcloud.com/nextcloud.asc # gpg key from https://nextcloud.com/nextcloud.asc
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \

View file

@ -14,8 +14,4 @@ if (getenv('REDIS_HOST')) {
} elseif (getenv('REDIS_HOST')[0] != '/') { } elseif (getenv('REDIS_HOST')[0] != '/') {
$CONFIG['redis']['port'] = 6379; $CONFIG['redis']['port'] = 6379;
} }
if (getenv('REDIS_HOST_USER') !== false) {
$CONFIG['redis']['user'] = (string) getenv('REDIS_HOST_USER');
}
} }

View file

@ -23,39 +23,32 @@ run_as() {
run_path() { run_path() {
local hook_folder_path="/docker-entrypoint-hooks.d/$1" local hook_folder_path="/docker-entrypoint-hooks.d/$1"
local return_code=0 local return_code=0
local found=0
echo "=> Searching for hook scripts (*.sh) to run, located in the folder \"${hook_folder_path}\"" if ! [ -d "${hook_folder_path}" ]; then
echo "=> Skipping the folder \"${hook_folder_path}\", because it doesn't exist"
if ! [ -d "${hook_folder_path}" ] || directory_empty "${hook_folder_path}"; then
echo "==> Skipped: the \"$1\" folder is empty (or does not exist)"
return 0 return 0
fi fi
find "${hook_folder_path}" -maxdepth 1 -iname '*.sh' '(' -type f -o -type l ')' -print | sort | ( echo "=> Searching for scripts (*.sh) to run, located in the folder: ${hook_folder_path}"
while read -r script_file_path; do
(
find "${hook_folder_path}" -maxdepth 1 -iname '*.sh' '(' -type f -o -type l ')' -print | sort | while read -r script_file_path; do
if ! [ -x "${script_file_path}" ]; then if ! [ -x "${script_file_path}" ]; then
echo "==> The script \"${script_file_path}\" was skipped, because it lacks the executable flag" echo "==> The script \"${script_file_path}\" was skipped, because it didn't have the executable flag"
found=$((found-1))
continue continue
fi fi
echo "==> Running the script (cwd: $(pwd)): \"${script_file_path}\"" echo "==> Running the script (cwd: $(pwd)): \"${script_file_path}\""
found=$((found+1))
run_as "${script_file_path}" || return_code="$?" run_as "${script_file_path}" || return_code="$?"
if [ "${return_code}" -ne "0" ]; then if [ "${return_code}" -ne "0" ]; then
echo "==> Failed at executing script \"${script_file_path}\". Exit code: ${return_code}" echo "==> Failed at executing \"${script_file_path}\". Exit code: ${return_code}"
exit 1 exit 1
fi fi
echo "==> Finished executing the script: \"${script_file_path}\"" echo "==> Finished the script: \"${script_file_path}\""
done done
if [ "$found" -lt "1" ]; then
echo "==> Skipped: the \"$1\" folder does not contain any valid scripts"
else
echo "=> Completed executing scripts in the \"$1\" folder"
fi
) )
} }
@ -121,21 +114,13 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
# check if redis host is an unix socket path # check if redis host is an unix socket path
if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then
if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
if [ -n "${REDIS_HOST_USER+x}" ]; then
echo "session.save_path = \"unix://${REDIS_HOST}?auth[]=${REDIS_HOST_USER}&auth[]=${REDIS_HOST_PASSWORD}\""
else
echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_HOST_PASSWORD}\"" echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_HOST_PASSWORD}\""
fi
else else
echo "session.save_path = \"unix://${REDIS_HOST}\"" echo "session.save_path = \"unix://${REDIS_HOST}\""
fi fi
# check if redis password has been set # check if redis password has been set
elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
if [ -n "${REDIS_HOST_USER+x}" ]; then
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth[]=${REDIS_HOST_USER}&auth[]=${REDIS_HOST_PASSWORD}\""
else
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\""
fi
else else
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\""
fi fi
@ -252,14 +237,12 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
fi fi
if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then
echo "Setting trusted domains…" echo "Setting trusted domains…"
set -f # turn off glob
NC_TRUSTED_DOMAIN_IDX=1 NC_TRUSTED_DOMAIN_IDX=1
for DOMAIN in ${NEXTCLOUD_TRUSTED_DOMAINS}; do for DOMAIN in $NEXTCLOUD_TRUSTED_DOMAINS ; do
DOMAIN=$(echo "${DOMAIN}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') DOMAIN=$(echo "$DOMAIN" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=\"${DOMAIN}\"" run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=$DOMAIN"
NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1)) NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1))
done done
set +f # turn glob back on
fi fi
run_path post-installation run_path post-installation

View file

@ -21,7 +21,6 @@ RUN set -ex; \
# see https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html # see https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html
ENV PHP_MEMORY_LIMIT 512M ENV PHP_MEMORY_LIMIT 512M
ENV PHP_UPLOAD_LIMIT 512M ENV PHP_UPLOAD_LIMIT 512M
ENV PHP_OPCACHE_MEMORY_CONSUMPTION 128
RUN set -ex; \ RUN set -ex; \
\ \
savedAptMark="$(apt-mark showmanual)"; \ savedAptMark="$(apt-mark showmanual)"; \
@ -67,16 +66,12 @@ RUN set -ex; \
\ \
# pecl will claim success even if one install fails, so we need to perform each install separately # pecl will claim success even if one install fails, so we need to perform each install separately
pecl install APCu-5.1.24; \ pecl install APCu-5.1.24; \
pecl install igbinary-3.2.16; \ pecl install imagick-3.7.0; \
pecl install imagick-3.8.0; \ pecl install memcached-3.3.0; \
pecl install memcached-3.3.0 \ pecl install redis-6.1.0; \
--configureoptions 'enable-memcached-igbinary="yes"'; \
pecl install redis-6.2.0 \
--configureoptions 'enable-redis-igbinary="yes" enable-redis-zstd="yes" enable-redis-lz4="yes"'; \
\ \
docker-php-ext-enable \ docker-php-ext-enable \
apcu \ apcu \
igbinary \
imagick \ imagick \
memcached \ memcached \
redis \ redis \
@ -103,20 +98,15 @@ RUN { \
echo 'opcache.enable=1'; \ echo 'opcache.enable=1'; \
echo 'opcache.interned_strings_buffer=32'; \ echo 'opcache.interned_strings_buffer=32'; \
echo 'opcache.max_accelerated_files=10000'; \ echo 'opcache.max_accelerated_files=10000'; \
echo 'opcache.memory_consumption=${PHP_OPCACHE_MEMORY_CONSUMPTION}'; \ echo 'opcache.memory_consumption=128'; \
echo 'opcache.save_comments=1'; \ echo 'opcache.save_comments=1'; \
echo 'opcache.revalidate_freq=60'; \ echo 'opcache.revalidate_freq=60'; \
echo 'opcache.jit=1255'; \ echo 'opcache.jit=1255'; \
echo 'opcache.jit_buffer_size=8M'; \ echo 'opcache.jit_buffer_size=128M'; \
} > "${PHP_INI_DIR}/conf.d/opcache-recommended.ini"; \ } > "${PHP_INI_DIR}/conf.d/opcache-recommended.ini"; \
\ \
echo 'apc.enable_cli=1' >> "${PHP_INI_DIR}/conf.d/docker-php-ext-apcu.ini"; \ echo 'apc.enable_cli=1' >> "${PHP_INI_DIR}/conf.d/docker-php-ext-apcu.ini"; \
\ \
{ \
echo 'apc.serializer=igbinary'; \
echo 'session.serialize_handler=igbinary'; \
} >> "${PHP_INI_DIR}/conf.d/docker-php-ext-igbinary.ini"; \
\
{ \ { \
echo 'memory_limit=${PHP_MEMORY_LIMIT}'; \ echo 'memory_limit=${PHP_MEMORY_LIMIT}'; \
echo 'upload_max_filesize=${PHP_UPLOAD_LIMIT}'; \ echo 'upload_max_filesize=${PHP_UPLOAD_LIMIT}'; \
@ -135,7 +125,7 @@ RUN { \
VOLUME /var/www/html VOLUME /var/www/html
ENV NEXTCLOUD_VERSION 29.0.16 ENV NEXTCLOUD_VERSION 29.0.10
RUN set -ex; \ RUN set -ex; \
fetchDeps=" \ fetchDeps=" \
@ -145,8 +135,8 @@ RUN set -ex; \
apt-get update; \ apt-get update; \
apt-get install -y --no-install-recommends $fetchDeps; \ apt-get install -y --no-install-recommends $fetchDeps; \
\ \
curl -fsSL -o nextcloud.tar.bz2 "https://download.nextcloud.com/server/releases/nextcloud-29.0.16.tar.bz2"; \ curl -fsSL -o nextcloud.tar.bz2 "https://download.nextcloud.com/server/releases/nextcloud-29.0.10.tar.bz2"; \
curl -fsSL -o nextcloud.tar.bz2.asc "https://download.nextcloud.com/server/releases/nextcloud-29.0.16.tar.bz2.asc"; \ curl -fsSL -o nextcloud.tar.bz2.asc "https://download.nextcloud.com/server/releases/nextcloud-29.0.10.tar.bz2.asc"; \
export GNUPGHOME="$(mktemp -d)"; \ export GNUPGHOME="$(mktemp -d)"; \
# gpg key from https://nextcloud.com/nextcloud.asc # gpg key from https://nextcloud.com/nextcloud.asc
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \

View file

@ -14,8 +14,4 @@ if (getenv('REDIS_HOST')) {
} elseif (getenv('REDIS_HOST')[0] != '/') { } elseif (getenv('REDIS_HOST')[0] != '/') {
$CONFIG['redis']['port'] = 6379; $CONFIG['redis']['port'] = 6379;
} }
if (getenv('REDIS_HOST_USER') !== false) {
$CONFIG['redis']['user'] = (string) getenv('REDIS_HOST_USER');
}
} }

View file

@ -23,39 +23,32 @@ run_as() {
run_path() { run_path() {
local hook_folder_path="/docker-entrypoint-hooks.d/$1" local hook_folder_path="/docker-entrypoint-hooks.d/$1"
local return_code=0 local return_code=0
local found=0
echo "=> Searching for hook scripts (*.sh) to run, located in the folder \"${hook_folder_path}\"" if ! [ -d "${hook_folder_path}" ]; then
echo "=> Skipping the folder \"${hook_folder_path}\", because it doesn't exist"
if ! [ -d "${hook_folder_path}" ] || directory_empty "${hook_folder_path}"; then
echo "==> Skipped: the \"$1\" folder is empty (or does not exist)"
return 0 return 0
fi fi
find "${hook_folder_path}" -maxdepth 1 -iname '*.sh' '(' -type f -o -type l ')' -print | sort | ( echo "=> Searching for scripts (*.sh) to run, located in the folder: ${hook_folder_path}"
while read -r script_file_path; do
(
find "${hook_folder_path}" -maxdepth 1 -iname '*.sh' '(' -type f -o -type l ')' -print | sort | while read -r script_file_path; do
if ! [ -x "${script_file_path}" ]; then if ! [ -x "${script_file_path}" ]; then
echo "==> The script \"${script_file_path}\" was skipped, because it lacks the executable flag" echo "==> The script \"${script_file_path}\" was skipped, because it didn't have the executable flag"
found=$((found-1))
continue continue
fi fi
echo "==> Running the script (cwd: $(pwd)): \"${script_file_path}\"" echo "==> Running the script (cwd: $(pwd)): \"${script_file_path}\""
found=$((found+1))
run_as "${script_file_path}" || return_code="$?" run_as "${script_file_path}" || return_code="$?"
if [ "${return_code}" -ne "0" ]; then if [ "${return_code}" -ne "0" ]; then
echo "==> Failed at executing script \"${script_file_path}\". Exit code: ${return_code}" echo "==> Failed at executing \"${script_file_path}\". Exit code: ${return_code}"
exit 1 exit 1
fi fi
echo "==> Finished executing the script: \"${script_file_path}\"" echo "==> Finished the script: \"${script_file_path}\""
done done
if [ "$found" -lt "1" ]; then
echo "==> Skipped: the \"$1\" folder does not contain any valid scripts"
else
echo "=> Completed executing scripts in the \"$1\" folder"
fi
) )
} }
@ -121,21 +114,13 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
# check if redis host is an unix socket path # check if redis host is an unix socket path
if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then
if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
if [ -n "${REDIS_HOST_USER+x}" ]; then
echo "session.save_path = \"unix://${REDIS_HOST}?auth[]=${REDIS_HOST_USER}&auth[]=${REDIS_HOST_PASSWORD}\""
else
echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_HOST_PASSWORD}\"" echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_HOST_PASSWORD}\""
fi
else else
echo "session.save_path = \"unix://${REDIS_HOST}\"" echo "session.save_path = \"unix://${REDIS_HOST}\""
fi fi
# check if redis password has been set # check if redis password has been set
elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
if [ -n "${REDIS_HOST_USER+x}" ]; then
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth[]=${REDIS_HOST_USER}&auth[]=${REDIS_HOST_PASSWORD}\""
else
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\""
fi
else else
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\""
fi fi
@ -252,14 +237,12 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
fi fi
if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then
echo "Setting trusted domains…" echo "Setting trusted domains…"
set -f # turn off glob
NC_TRUSTED_DOMAIN_IDX=1 NC_TRUSTED_DOMAIN_IDX=1
for DOMAIN in ${NEXTCLOUD_TRUSTED_DOMAINS}; do for DOMAIN in $NEXTCLOUD_TRUSTED_DOMAINS ; do
DOMAIN=$(echo "${DOMAIN}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') DOMAIN=$(echo "$DOMAIN" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=\"${DOMAIN}\"" run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=$DOMAIN"
NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1)) NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1))
done done
set +f # turn glob back on
fi fi
run_path post-installation run_path post-installation

View file

@ -21,7 +21,6 @@ RUN set -ex; \
# see https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html # see https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html
ENV PHP_MEMORY_LIMIT 512M ENV PHP_MEMORY_LIMIT 512M
ENV PHP_UPLOAD_LIMIT 512M ENV PHP_UPLOAD_LIMIT 512M
ENV PHP_OPCACHE_MEMORY_CONSUMPTION 128
RUN set -ex; \ RUN set -ex; \
\ \
savedAptMark="$(apt-mark showmanual)"; \ savedAptMark="$(apt-mark showmanual)"; \
@ -67,16 +66,12 @@ RUN set -ex; \
\ \
# pecl will claim success even if one install fails, so we need to perform each install separately # pecl will claim success even if one install fails, so we need to perform each install separately
pecl install APCu-5.1.24; \ pecl install APCu-5.1.24; \
pecl install igbinary-3.2.16; \ pecl install imagick-3.7.0; \
pecl install imagick-3.8.0; \ pecl install memcached-3.3.0; \
pecl install memcached-3.3.0 \ pecl install redis-6.1.0; \
--configureoptions 'enable-memcached-igbinary="yes"'; \
pecl install redis-6.2.0 \
--configureoptions 'enable-redis-igbinary="yes" enable-redis-zstd="yes" enable-redis-lz4="yes"'; \
\ \
docker-php-ext-enable \ docker-php-ext-enable \
apcu \ apcu \
igbinary \
imagick \ imagick \
memcached \ memcached \
redis \ redis \
@ -103,20 +98,15 @@ RUN { \
echo 'opcache.enable=1'; \ echo 'opcache.enable=1'; \
echo 'opcache.interned_strings_buffer=32'; \ echo 'opcache.interned_strings_buffer=32'; \
echo 'opcache.max_accelerated_files=10000'; \ echo 'opcache.max_accelerated_files=10000'; \
echo 'opcache.memory_consumption=${PHP_OPCACHE_MEMORY_CONSUMPTION}'; \ echo 'opcache.memory_consumption=128'; \
echo 'opcache.save_comments=1'; \ echo 'opcache.save_comments=1'; \
echo 'opcache.revalidate_freq=60'; \ echo 'opcache.revalidate_freq=60'; \
echo 'opcache.jit=1255'; \ echo 'opcache.jit=1255'; \
echo 'opcache.jit_buffer_size=8M'; \ echo 'opcache.jit_buffer_size=128M'; \
} > "${PHP_INI_DIR}/conf.d/opcache-recommended.ini"; \ } > "${PHP_INI_DIR}/conf.d/opcache-recommended.ini"; \
\ \
echo 'apc.enable_cli=1' >> "${PHP_INI_DIR}/conf.d/docker-php-ext-apcu.ini"; \ echo 'apc.enable_cli=1' >> "${PHP_INI_DIR}/conf.d/docker-php-ext-apcu.ini"; \
\ \
{ \
echo 'apc.serializer=igbinary'; \
echo 'session.serialize_handler=igbinary'; \
} >> "${PHP_INI_DIR}/conf.d/docker-php-ext-igbinary.ini"; \
\
{ \ { \
echo 'memory_limit=${PHP_MEMORY_LIMIT}'; \ echo 'memory_limit=${PHP_MEMORY_LIMIT}'; \
echo 'upload_max_filesize=${PHP_UPLOAD_LIMIT}'; \ echo 'upload_max_filesize=${PHP_UPLOAD_LIMIT}'; \
@ -150,7 +140,7 @@ RUN { \
} > /etc/apache2/conf-available/apache-limits.conf; \ } > /etc/apache2/conf-available/apache-limits.conf; \
a2enconf apache-limits a2enconf apache-limits
ENV NEXTCLOUD_VERSION 30.0.10 ENV NEXTCLOUD_VERSION 30.0.4
RUN set -ex; \ RUN set -ex; \
fetchDeps=" \ fetchDeps=" \
@ -160,8 +150,8 @@ RUN set -ex; \
apt-get update; \ apt-get update; \
apt-get install -y --no-install-recommends $fetchDeps; \ apt-get install -y --no-install-recommends $fetchDeps; \
\ \
curl -fsSL -o nextcloud.tar.bz2 "https://download.nextcloud.com/server/releases/nextcloud-30.0.10.tar.bz2"; \ curl -fsSL -o nextcloud.tar.bz2 "https://download.nextcloud.com/server/releases/nextcloud-30.0.4.tar.bz2"; \
curl -fsSL -o nextcloud.tar.bz2.asc "https://download.nextcloud.com/server/releases/nextcloud-30.0.10.tar.bz2.asc"; \ curl -fsSL -o nextcloud.tar.bz2.asc "https://download.nextcloud.com/server/releases/nextcloud-30.0.4.tar.bz2.asc"; \
export GNUPGHOME="$(mktemp -d)"; \ export GNUPGHOME="$(mktemp -d)"; \
# gpg key from https://nextcloud.com/nextcloud.asc # gpg key from https://nextcloud.com/nextcloud.asc
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \

View file

@ -14,8 +14,4 @@ if (getenv('REDIS_HOST')) {
} elseif (getenv('REDIS_HOST')[0] != '/') { } elseif (getenv('REDIS_HOST')[0] != '/') {
$CONFIG['redis']['port'] = 6379; $CONFIG['redis']['port'] = 6379;
} }
if (getenv('REDIS_HOST_USER') !== false) {
$CONFIG['redis']['user'] = (string) getenv('REDIS_HOST_USER');
}
} }

View file

@ -23,39 +23,32 @@ run_as() {
run_path() { run_path() {
local hook_folder_path="/docker-entrypoint-hooks.d/$1" local hook_folder_path="/docker-entrypoint-hooks.d/$1"
local return_code=0 local return_code=0
local found=0
echo "=> Searching for hook scripts (*.sh) to run, located in the folder \"${hook_folder_path}\"" if ! [ -d "${hook_folder_path}" ]; then
echo "=> Skipping the folder \"${hook_folder_path}\", because it doesn't exist"
if ! [ -d "${hook_folder_path}" ] || directory_empty "${hook_folder_path}"; then
echo "==> Skipped: the \"$1\" folder is empty (or does not exist)"
return 0 return 0
fi fi
find "${hook_folder_path}" -maxdepth 1 -iname '*.sh' '(' -type f -o -type l ')' -print | sort | ( echo "=> Searching for scripts (*.sh) to run, located in the folder: ${hook_folder_path}"
while read -r script_file_path; do
(
find "${hook_folder_path}" -maxdepth 1 -iname '*.sh' '(' -type f -o -type l ')' -print | sort | while read -r script_file_path; do
if ! [ -x "${script_file_path}" ]; then if ! [ -x "${script_file_path}" ]; then
echo "==> The script \"${script_file_path}\" was skipped, because it lacks the executable flag" echo "==> The script \"${script_file_path}\" was skipped, because it didn't have the executable flag"
found=$((found-1))
continue continue
fi fi
echo "==> Running the script (cwd: $(pwd)): \"${script_file_path}\"" echo "==> Running the script (cwd: $(pwd)): \"${script_file_path}\""
found=$((found+1))
run_as "${script_file_path}" || return_code="$?" run_as "${script_file_path}" || return_code="$?"
if [ "${return_code}" -ne "0" ]; then if [ "${return_code}" -ne "0" ]; then
echo "==> Failed at executing script \"${script_file_path}\". Exit code: ${return_code}" echo "==> Failed at executing \"${script_file_path}\". Exit code: ${return_code}"
exit 1 exit 1
fi fi
echo "==> Finished executing the script: \"${script_file_path}\"" echo "==> Finished the script: \"${script_file_path}\""
done done
if [ "$found" -lt "1" ]; then
echo "==> Skipped: the \"$1\" folder does not contain any valid scripts"
else
echo "=> Completed executing scripts in the \"$1\" folder"
fi
) )
} }
@ -121,21 +114,13 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
# check if redis host is an unix socket path # check if redis host is an unix socket path
if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then
if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
if [ -n "${REDIS_HOST_USER+x}" ]; then
echo "session.save_path = \"unix://${REDIS_HOST}?auth[]=${REDIS_HOST_USER}&auth[]=${REDIS_HOST_PASSWORD}\""
else
echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_HOST_PASSWORD}\"" echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_HOST_PASSWORD}\""
fi
else else
echo "session.save_path = \"unix://${REDIS_HOST}\"" echo "session.save_path = \"unix://${REDIS_HOST}\""
fi fi
# check if redis password has been set # check if redis password has been set
elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
if [ -n "${REDIS_HOST_USER+x}" ]; then
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth[]=${REDIS_HOST_USER}&auth[]=${REDIS_HOST_PASSWORD}\""
else
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\""
fi
else else
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\""
fi fi
@ -252,14 +237,12 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
fi fi
if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then
echo "Setting trusted domains…" echo "Setting trusted domains…"
set -f # turn off glob
NC_TRUSTED_DOMAIN_IDX=1 NC_TRUSTED_DOMAIN_IDX=1
for DOMAIN in ${NEXTCLOUD_TRUSTED_DOMAINS}; do for DOMAIN in $NEXTCLOUD_TRUSTED_DOMAINS ; do
DOMAIN=$(echo "${DOMAIN}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') DOMAIN=$(echo "$DOMAIN" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=\"${DOMAIN}\"" run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=$DOMAIN"
NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1)) NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1))
done done
set +f # turn glob back on
fi fi
run_path post-installation run_path post-installation

View file

@ -1,5 +1,5 @@
# DO NOT EDIT: created by update.sh from Dockerfile-alpine.template # DO NOT EDIT: created by update.sh from Dockerfile-alpine.template
FROM php:8.2-fpm-alpine3.21 FROM php:8.2-fpm-alpine3.20
# entrypoint.sh and cron.sh dependencies # entrypoint.sh and cron.sh dependencies
RUN set -ex; \ RUN set -ex; \
@ -64,16 +64,12 @@ RUN set -ex; \
\ \
# pecl will claim success even if one install fails, so we need to perform each install separately # pecl will claim success even if one install fails, so we need to perform each install separately
pecl install APCu-5.1.24; \ pecl install APCu-5.1.24; \
pecl install igbinary-3.2.16; \ pecl install imagick-3.7.0; \
pecl install imagick-3.8.0; \ pecl install memcached-3.3.0; \
pecl install memcached-3.3.0 \ pecl install redis-6.1.0; \
--configureoptions 'enable-memcached-igbinary="yes"'; \
pecl install redis-6.2.0 \
--configureoptions 'enable-redis-igbinary="yes" enable-redis-zstd="yes" enable-redis-lz4="yes"'; \
\ \
docker-php-ext-enable \ docker-php-ext-enable \
apcu \ apcu \
igbinary \
imagick \ imagick \
memcached \ memcached \
redis \ redis \
@ -93,25 +89,19 @@ RUN set -ex; \
# see https://docs.nextcloud.com/server/latest/admin_manual/installation/server_tuning.html#enable-php-opcache # see https://docs.nextcloud.com/server/latest/admin_manual/installation/server_tuning.html#enable-php-opcache
ENV PHP_MEMORY_LIMIT 512M ENV PHP_MEMORY_LIMIT 512M
ENV PHP_UPLOAD_LIMIT 512M ENV PHP_UPLOAD_LIMIT 512M
ENV PHP_OPCACHE_MEMORY_CONSUMPTION 128
RUN { \ RUN { \
echo 'opcache.enable=1'; \ echo 'opcache.enable=1'; \
echo 'opcache.interned_strings_buffer=32'; \ echo 'opcache.interned_strings_buffer=32'; \
echo 'opcache.max_accelerated_files=10000'; \ echo 'opcache.max_accelerated_files=10000'; \
echo 'opcache.memory_consumption=${PHP_OPCACHE_MEMORY_CONSUMPTION}'; \ echo 'opcache.memory_consumption=128'; \
echo 'opcache.save_comments=1'; \ echo 'opcache.save_comments=1'; \
echo 'opcache.revalidate_freq=60'; \ echo 'opcache.revalidate_freq=60'; \
echo 'opcache.jit=1255'; \ echo 'opcache.jit=1255'; \
echo 'opcache.jit_buffer_size=8M'; \ echo 'opcache.jit_buffer_size=128M'; \
} > "${PHP_INI_DIR}/conf.d/opcache-recommended.ini"; \ } > "${PHP_INI_DIR}/conf.d/opcache-recommended.ini"; \
\ \
echo 'apc.enable_cli=1' >> "${PHP_INI_DIR}/conf.d/docker-php-ext-apcu.ini"; \ echo 'apc.enable_cli=1' >> "${PHP_INI_DIR}/conf.d/docker-php-ext-apcu.ini"; \
\ \
{ \
echo 'apc.serializer=igbinary'; \
echo 'session.serialize_handler=igbinary'; \
} >> "${PHP_INI_DIR}/conf.d/docker-php-ext-igbinary.ini"; \
\
{ \ { \
echo 'memory_limit=${PHP_MEMORY_LIMIT}'; \ echo 'memory_limit=${PHP_MEMORY_LIMIT}'; \
echo 'upload_max_filesize=${PHP_UPLOAD_LIMIT}'; \ echo 'upload_max_filesize=${PHP_UPLOAD_LIMIT}'; \
@ -130,7 +120,7 @@ RUN { \
VOLUME /var/www/html VOLUME /var/www/html
ENV NEXTCLOUD_VERSION 30.0.10 ENV NEXTCLOUD_VERSION 30.0.4
RUN set -ex; \ RUN set -ex; \
apk add --no-cache --virtual .fetch-deps \ apk add --no-cache --virtual .fetch-deps \
@ -138,8 +128,8 @@ RUN set -ex; \
gnupg \ gnupg \
; \ ; \
\ \
curl -fsSL -o nextcloud.tar.bz2 "https://download.nextcloud.com/server/releases/nextcloud-30.0.10.tar.bz2"; \ curl -fsSL -o nextcloud.tar.bz2 "https://download.nextcloud.com/server/releases/nextcloud-30.0.4.tar.bz2"; \
curl -fsSL -o nextcloud.tar.bz2.asc "https://download.nextcloud.com/server/releases/nextcloud-30.0.10.tar.bz2.asc"; \ curl -fsSL -o nextcloud.tar.bz2.asc "https://download.nextcloud.com/server/releases/nextcloud-30.0.4.tar.bz2.asc"; \
export GNUPGHOME="$(mktemp -d)"; \ export GNUPGHOME="$(mktemp -d)"; \
# gpg key from https://nextcloud.com/nextcloud.asc # gpg key from https://nextcloud.com/nextcloud.asc
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \

View file

@ -14,8 +14,4 @@ if (getenv('REDIS_HOST')) {
} elseif (getenv('REDIS_HOST')[0] != '/') { } elseif (getenv('REDIS_HOST')[0] != '/') {
$CONFIG['redis']['port'] = 6379; $CONFIG['redis']['port'] = 6379;
} }
if (getenv('REDIS_HOST_USER') !== false) {
$CONFIG['redis']['user'] = (string) getenv('REDIS_HOST_USER');
}
} }

View file

@ -23,39 +23,32 @@ run_as() {
run_path() { run_path() {
local hook_folder_path="/docker-entrypoint-hooks.d/$1" local hook_folder_path="/docker-entrypoint-hooks.d/$1"
local return_code=0 local return_code=0
local found=0
echo "=> Searching for hook scripts (*.sh) to run, located in the folder \"${hook_folder_path}\"" if ! [ -d "${hook_folder_path}" ]; then
echo "=> Skipping the folder \"${hook_folder_path}\", because it doesn't exist"
if ! [ -d "${hook_folder_path}" ] || directory_empty "${hook_folder_path}"; then
echo "==> Skipped: the \"$1\" folder is empty (or does not exist)"
return 0 return 0
fi fi
find "${hook_folder_path}" -maxdepth 1 -iname '*.sh' '(' -type f -o -type l ')' -print | sort | ( echo "=> Searching for scripts (*.sh) to run, located in the folder: ${hook_folder_path}"
while read -r script_file_path; do
(
find "${hook_folder_path}" -maxdepth 1 -iname '*.sh' '(' -type f -o -type l ')' -print | sort | while read -r script_file_path; do
if ! [ -x "${script_file_path}" ]; then if ! [ -x "${script_file_path}" ]; then
echo "==> The script \"${script_file_path}\" was skipped, because it lacks the executable flag" echo "==> The script \"${script_file_path}\" was skipped, because it didn't have the executable flag"
found=$((found-1))
continue continue
fi fi
echo "==> Running the script (cwd: $(pwd)): \"${script_file_path}\"" echo "==> Running the script (cwd: $(pwd)): \"${script_file_path}\""
found=$((found+1))
run_as "${script_file_path}" || return_code="$?" run_as "${script_file_path}" || return_code="$?"
if [ "${return_code}" -ne "0" ]; then if [ "${return_code}" -ne "0" ]; then
echo "==> Failed at executing script \"${script_file_path}\". Exit code: ${return_code}" echo "==> Failed at executing \"${script_file_path}\". Exit code: ${return_code}"
exit 1 exit 1
fi fi
echo "==> Finished executing the script: \"${script_file_path}\"" echo "==> Finished the script: \"${script_file_path}\""
done done
if [ "$found" -lt "1" ]; then
echo "==> Skipped: the \"$1\" folder does not contain any valid scripts"
else
echo "=> Completed executing scripts in the \"$1\" folder"
fi
) )
} }
@ -121,21 +114,13 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
# check if redis host is an unix socket path # check if redis host is an unix socket path
if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then
if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
if [ -n "${REDIS_HOST_USER+x}" ]; then
echo "session.save_path = \"unix://${REDIS_HOST}?auth[]=${REDIS_HOST_USER}&auth[]=${REDIS_HOST_PASSWORD}\""
else
echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_HOST_PASSWORD}\"" echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_HOST_PASSWORD}\""
fi
else else
echo "session.save_path = \"unix://${REDIS_HOST}\"" echo "session.save_path = \"unix://${REDIS_HOST}\""
fi fi
# check if redis password has been set # check if redis password has been set
elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
if [ -n "${REDIS_HOST_USER+x}" ]; then
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth[]=${REDIS_HOST_USER}&auth[]=${REDIS_HOST_PASSWORD}\""
else
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\""
fi
else else
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\""
fi fi
@ -252,14 +237,12 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
fi fi
if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then
echo "Setting trusted domains…" echo "Setting trusted domains…"
set -f # turn off glob
NC_TRUSTED_DOMAIN_IDX=1 NC_TRUSTED_DOMAIN_IDX=1
for DOMAIN in ${NEXTCLOUD_TRUSTED_DOMAINS}; do for DOMAIN in $NEXTCLOUD_TRUSTED_DOMAINS ; do
DOMAIN=$(echo "${DOMAIN}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') DOMAIN=$(echo "$DOMAIN" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=\"${DOMAIN}\"" run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=$DOMAIN"
NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1)) NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1))
done done
set +f # turn glob back on
fi fi
run_path post-installation run_path post-installation

View file

@ -21,7 +21,6 @@ RUN set -ex; \
# see https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html # see https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html
ENV PHP_MEMORY_LIMIT 512M ENV PHP_MEMORY_LIMIT 512M
ENV PHP_UPLOAD_LIMIT 512M ENV PHP_UPLOAD_LIMIT 512M
ENV PHP_OPCACHE_MEMORY_CONSUMPTION 128
RUN set -ex; \ RUN set -ex; \
\ \
savedAptMark="$(apt-mark showmanual)"; \ savedAptMark="$(apt-mark showmanual)"; \
@ -67,16 +66,12 @@ RUN set -ex; \
\ \
# pecl will claim success even if one install fails, so we need to perform each install separately # pecl will claim success even if one install fails, so we need to perform each install separately
pecl install APCu-5.1.24; \ pecl install APCu-5.1.24; \
pecl install igbinary-3.2.16; \ pecl install imagick-3.7.0; \
pecl install imagick-3.8.0; \ pecl install memcached-3.3.0; \
pecl install memcached-3.3.0 \ pecl install redis-6.1.0; \
--configureoptions 'enable-memcached-igbinary="yes"'; \
pecl install redis-6.2.0 \
--configureoptions 'enable-redis-igbinary="yes" enable-redis-zstd="yes" enable-redis-lz4="yes"'; \
\ \
docker-php-ext-enable \ docker-php-ext-enable \
apcu \ apcu \
igbinary \
imagick \ imagick \
memcached \ memcached \
redis \ redis \
@ -103,20 +98,15 @@ RUN { \
echo 'opcache.enable=1'; \ echo 'opcache.enable=1'; \
echo 'opcache.interned_strings_buffer=32'; \ echo 'opcache.interned_strings_buffer=32'; \
echo 'opcache.max_accelerated_files=10000'; \ echo 'opcache.max_accelerated_files=10000'; \
echo 'opcache.memory_consumption=${PHP_OPCACHE_MEMORY_CONSUMPTION}'; \ echo 'opcache.memory_consumption=128'; \
echo 'opcache.save_comments=1'; \ echo 'opcache.save_comments=1'; \
echo 'opcache.revalidate_freq=60'; \ echo 'opcache.revalidate_freq=60'; \
echo 'opcache.jit=1255'; \ echo 'opcache.jit=1255'; \
echo 'opcache.jit_buffer_size=8M'; \ echo 'opcache.jit_buffer_size=128M'; \
} > "${PHP_INI_DIR}/conf.d/opcache-recommended.ini"; \ } > "${PHP_INI_DIR}/conf.d/opcache-recommended.ini"; \
\ \
echo 'apc.enable_cli=1' >> "${PHP_INI_DIR}/conf.d/docker-php-ext-apcu.ini"; \ echo 'apc.enable_cli=1' >> "${PHP_INI_DIR}/conf.d/docker-php-ext-apcu.ini"; \
\ \
{ \
echo 'apc.serializer=igbinary'; \
echo 'session.serialize_handler=igbinary'; \
} >> "${PHP_INI_DIR}/conf.d/docker-php-ext-igbinary.ini"; \
\
{ \ { \
echo 'memory_limit=${PHP_MEMORY_LIMIT}'; \ echo 'memory_limit=${PHP_MEMORY_LIMIT}'; \
echo 'upload_max_filesize=${PHP_UPLOAD_LIMIT}'; \ echo 'upload_max_filesize=${PHP_UPLOAD_LIMIT}'; \
@ -135,7 +125,7 @@ RUN { \
VOLUME /var/www/html VOLUME /var/www/html
ENV NEXTCLOUD_VERSION 30.0.10 ENV NEXTCLOUD_VERSION 30.0.4
RUN set -ex; \ RUN set -ex; \
fetchDeps=" \ fetchDeps=" \
@ -145,8 +135,8 @@ RUN set -ex; \
apt-get update; \ apt-get update; \
apt-get install -y --no-install-recommends $fetchDeps; \ apt-get install -y --no-install-recommends $fetchDeps; \
\ \
curl -fsSL -o nextcloud.tar.bz2 "https://download.nextcloud.com/server/releases/nextcloud-30.0.10.tar.bz2"; \ curl -fsSL -o nextcloud.tar.bz2 "https://download.nextcloud.com/server/releases/nextcloud-30.0.4.tar.bz2"; \
curl -fsSL -o nextcloud.tar.bz2.asc "https://download.nextcloud.com/server/releases/nextcloud-30.0.10.tar.bz2.asc"; \ curl -fsSL -o nextcloud.tar.bz2.asc "https://download.nextcloud.com/server/releases/nextcloud-30.0.4.tar.bz2.asc"; \
export GNUPGHOME="$(mktemp -d)"; \ export GNUPGHOME="$(mktemp -d)"; \
# gpg key from https://nextcloud.com/nextcloud.asc # gpg key from https://nextcloud.com/nextcloud.asc
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \

View file

@ -14,8 +14,4 @@ if (getenv('REDIS_HOST')) {
} elseif (getenv('REDIS_HOST')[0] != '/') { } elseif (getenv('REDIS_HOST')[0] != '/') {
$CONFIG['redis']['port'] = 6379; $CONFIG['redis']['port'] = 6379;
} }
if (getenv('REDIS_HOST_USER') !== false) {
$CONFIG['redis']['user'] = (string) getenv('REDIS_HOST_USER');
}
} }

View file

@ -23,39 +23,32 @@ run_as() {
run_path() { run_path() {
local hook_folder_path="/docker-entrypoint-hooks.d/$1" local hook_folder_path="/docker-entrypoint-hooks.d/$1"
local return_code=0 local return_code=0
local found=0
echo "=> Searching for hook scripts (*.sh) to run, located in the folder \"${hook_folder_path}\"" if ! [ -d "${hook_folder_path}" ]; then
echo "=> Skipping the folder \"${hook_folder_path}\", because it doesn't exist"
if ! [ -d "${hook_folder_path}" ] || directory_empty "${hook_folder_path}"; then
echo "==> Skipped: the \"$1\" folder is empty (or does not exist)"
return 0 return 0
fi fi
find "${hook_folder_path}" -maxdepth 1 -iname '*.sh' '(' -type f -o -type l ')' -print | sort | ( echo "=> Searching for scripts (*.sh) to run, located in the folder: ${hook_folder_path}"
while read -r script_file_path; do
(
find "${hook_folder_path}" -maxdepth 1 -iname '*.sh' '(' -type f -o -type l ')' -print | sort | while read -r script_file_path; do
if ! [ -x "${script_file_path}" ]; then if ! [ -x "${script_file_path}" ]; then
echo "==> The script \"${script_file_path}\" was skipped, because it lacks the executable flag" echo "==> The script \"${script_file_path}\" was skipped, because it didn't have the executable flag"
found=$((found-1))
continue continue
fi fi
echo "==> Running the script (cwd: $(pwd)): \"${script_file_path}\"" echo "==> Running the script (cwd: $(pwd)): \"${script_file_path}\""
found=$((found+1))
run_as "${script_file_path}" || return_code="$?" run_as "${script_file_path}" || return_code="$?"
if [ "${return_code}" -ne "0" ]; then if [ "${return_code}" -ne "0" ]; then
echo "==> Failed at executing script \"${script_file_path}\". Exit code: ${return_code}" echo "==> Failed at executing \"${script_file_path}\". Exit code: ${return_code}"
exit 1 exit 1
fi fi
echo "==> Finished executing the script: \"${script_file_path}\"" echo "==> Finished the script: \"${script_file_path}\""
done done
if [ "$found" -lt "1" ]; then
echo "==> Skipped: the \"$1\" folder does not contain any valid scripts"
else
echo "=> Completed executing scripts in the \"$1\" folder"
fi
) )
} }
@ -121,21 +114,13 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
# check if redis host is an unix socket path # check if redis host is an unix socket path
if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then
if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
if [ -n "${REDIS_HOST_USER+x}" ]; then
echo "session.save_path = \"unix://${REDIS_HOST}?auth[]=${REDIS_HOST_USER}&auth[]=${REDIS_HOST_PASSWORD}\""
else
echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_HOST_PASSWORD}\"" echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_HOST_PASSWORD}\""
fi
else else
echo "session.save_path = \"unix://${REDIS_HOST}\"" echo "session.save_path = \"unix://${REDIS_HOST}\""
fi fi
# check if redis password has been set # check if redis password has been set
elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
if [ -n "${REDIS_HOST_USER+x}" ]; then
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth[]=${REDIS_HOST_USER}&auth[]=${REDIS_HOST_PASSWORD}\""
else
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\""
fi
else else
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\""
fi fi
@ -252,14 +237,12 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
fi fi
if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then
echo "Setting trusted domains…" echo "Setting trusted domains…"
set -f # turn off glob
NC_TRUSTED_DOMAIN_IDX=1 NC_TRUSTED_DOMAIN_IDX=1
for DOMAIN in ${NEXTCLOUD_TRUSTED_DOMAINS}; do for DOMAIN in $NEXTCLOUD_TRUSTED_DOMAINS ; do
DOMAIN=$(echo "${DOMAIN}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') DOMAIN=$(echo "$DOMAIN" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=\"${DOMAIN}\"" run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=$DOMAIN"
NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1)) NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1))
done done
set +f # turn glob back on
fi fi
run_path post-installation run_path post-installation

View file

@ -63,16 +63,12 @@ RUN set -ex; \
\ \
# pecl will claim success even if one install fails, so we need to perform each install separately # pecl will claim success even if one install fails, so we need to perform each install separately
pecl install APCu-%%APCU_VERSION%%; \ pecl install APCu-%%APCU_VERSION%%; \
pecl install igbinary-%%IGBINARY_VERSION%%; \
pecl install imagick-%%IMAGICK_VERSION%%; \ pecl install imagick-%%IMAGICK_VERSION%%; \
pecl install memcached-%%MEMCACHED_VERSION%% \ pecl install memcached-%%MEMCACHED_VERSION%%; \
--configureoptions 'enable-memcached-igbinary="yes"'; \ pecl install redis-%%REDIS_VERSION%%; \
pecl install redis-%%REDIS_VERSION%% \
--configureoptions 'enable-redis-igbinary="yes" enable-redis-zstd="yes" enable-redis-lz4="yes"'; \
\ \
docker-php-ext-enable \ docker-php-ext-enable \
apcu \ apcu \
igbinary \
imagick \ imagick \
memcached \ memcached \
redis \ redis \
@ -92,25 +88,19 @@ RUN set -ex; \
# see https://docs.nextcloud.com/server/latest/admin_manual/installation/server_tuning.html#enable-php-opcache # see https://docs.nextcloud.com/server/latest/admin_manual/installation/server_tuning.html#enable-php-opcache
ENV PHP_MEMORY_LIMIT 512M ENV PHP_MEMORY_LIMIT 512M
ENV PHP_UPLOAD_LIMIT 512M ENV PHP_UPLOAD_LIMIT 512M
ENV PHP_OPCACHE_MEMORY_CONSUMPTION 128
RUN { \ RUN { \
echo 'opcache.enable=1'; \ echo 'opcache.enable=1'; \
echo 'opcache.interned_strings_buffer=32'; \ echo 'opcache.interned_strings_buffer=32'; \
echo 'opcache.max_accelerated_files=10000'; \ echo 'opcache.max_accelerated_files=10000'; \
echo 'opcache.memory_consumption=${PHP_OPCACHE_MEMORY_CONSUMPTION}'; \ echo 'opcache.memory_consumption=128'; \
echo 'opcache.save_comments=1'; \ echo 'opcache.save_comments=1'; \
echo 'opcache.revalidate_freq=60'; \ echo 'opcache.revalidate_freq=60'; \
echo 'opcache.jit=1255'; \ echo 'opcache.jit=1255'; \
echo 'opcache.jit_buffer_size=8M'; \ echo 'opcache.jit_buffer_size=128M'; \
} > "${PHP_INI_DIR}/conf.d/opcache-recommended.ini"; \ } > "${PHP_INI_DIR}/conf.d/opcache-recommended.ini"; \
\ \
echo 'apc.enable_cli=1' >> "${PHP_INI_DIR}/conf.d/docker-php-ext-apcu.ini"; \ echo 'apc.enable_cli=1' >> "${PHP_INI_DIR}/conf.d/docker-php-ext-apcu.ini"; \
\ \
{ \
echo 'apc.serializer=igbinary'; \
echo 'session.serialize_handler=igbinary'; \
} >> "${PHP_INI_DIR}/conf.d/docker-php-ext-igbinary.ini"; \
\
{ \ { \
echo 'memory_limit=${PHP_MEMORY_LIMIT}'; \ echo 'memory_limit=${PHP_MEMORY_LIMIT}'; \
echo 'upload_max_filesize=${PHP_UPLOAD_LIMIT}'; \ echo 'upload_max_filesize=${PHP_UPLOAD_LIMIT}'; \

View file

@ -20,7 +20,6 @@ RUN set -ex; \
# see https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html # see https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html
ENV PHP_MEMORY_LIMIT 512M ENV PHP_MEMORY_LIMIT 512M
ENV PHP_UPLOAD_LIMIT 512M ENV PHP_UPLOAD_LIMIT 512M
ENV PHP_OPCACHE_MEMORY_CONSUMPTION 128
RUN set -ex; \ RUN set -ex; \
\ \
savedAptMark="$(apt-mark showmanual)"; \ savedAptMark="$(apt-mark showmanual)"; \
@ -66,16 +65,12 @@ RUN set -ex; \
\ \
# pecl will claim success even if one install fails, so we need to perform each install separately # pecl will claim success even if one install fails, so we need to perform each install separately
pecl install APCu-%%APCU_VERSION%%; \ pecl install APCu-%%APCU_VERSION%%; \
pecl install igbinary-%%IGBINARY_VERSION%%; \
pecl install imagick-%%IMAGICK_VERSION%%; \ pecl install imagick-%%IMAGICK_VERSION%%; \
pecl install memcached-%%MEMCACHED_VERSION%% \ pecl install memcached-%%MEMCACHED_VERSION%%; \
--configureoptions 'enable-memcached-igbinary="yes"'; \ pecl install redis-%%REDIS_VERSION%%; \
pecl install redis-%%REDIS_VERSION%% \
--configureoptions 'enable-redis-igbinary="yes" enable-redis-zstd="yes" enable-redis-lz4="yes"'; \
\ \
docker-php-ext-enable \ docker-php-ext-enable \
apcu \ apcu \
igbinary \
imagick \ imagick \
memcached \ memcached \
redis \ redis \
@ -102,20 +97,15 @@ RUN { \
echo 'opcache.enable=1'; \ echo 'opcache.enable=1'; \
echo 'opcache.interned_strings_buffer=32'; \ echo 'opcache.interned_strings_buffer=32'; \
echo 'opcache.max_accelerated_files=10000'; \ echo 'opcache.max_accelerated_files=10000'; \
echo 'opcache.memory_consumption=${PHP_OPCACHE_MEMORY_CONSUMPTION}'; \ echo 'opcache.memory_consumption=128'; \
echo 'opcache.save_comments=1'; \ echo 'opcache.save_comments=1'; \
echo 'opcache.revalidate_freq=60'; \ echo 'opcache.revalidate_freq=60'; \
echo 'opcache.jit=1255'; \ echo 'opcache.jit=1255'; \
echo 'opcache.jit_buffer_size=8M'; \ echo 'opcache.jit_buffer_size=128M'; \
} > "${PHP_INI_DIR}/conf.d/opcache-recommended.ini"; \ } > "${PHP_INI_DIR}/conf.d/opcache-recommended.ini"; \
\ \
echo 'apc.enable_cli=1' >> "${PHP_INI_DIR}/conf.d/docker-php-ext-apcu.ini"; \ echo 'apc.enable_cli=1' >> "${PHP_INI_DIR}/conf.d/docker-php-ext-apcu.ini"; \
\ \
{ \
echo 'apc.serializer=igbinary'; \
echo 'session.serialize_handler=igbinary'; \
} >> "${PHP_INI_DIR}/conf.d/docker-php-ext-igbinary.ini"; \
\
{ \ { \
echo 'memory_limit=${PHP_MEMORY_LIMIT}'; \ echo 'memory_limit=${PHP_MEMORY_LIMIT}'; \
echo 'upload_max_filesize=${PHP_UPLOAD_LIMIT}'; \ echo 'upload_max_filesize=${PHP_UPLOAD_LIMIT}'; \

View file

@ -141,23 +141,12 @@ If mounting additional volumes under `/var/www/html`, you should consider:
**Data inside the main folder (`/var/www/html`) will be overridden/removed during installation and upgrades, unless listed in [upgrade.exclude](https://github.com/nextcloud/docker/blob/master/upgrade.exclude).** The additional volumes officially supported are already in that list, but custom volumes will need to be added by you. We suggest mounting custom storage volumes outside of `/var/www/html` and if possible read-only so that making this adjustment is unnecessary. If you must do so, however, you may build a custom image with a modified `/upgrade.exclude` file that incorporates your custom volume(s). **Data inside the main folder (`/var/www/html`) will be overridden/removed during installation and upgrades, unless listed in [upgrade.exclude](https://github.com/nextcloud/docker/blob/master/upgrade.exclude).** The additional volumes officially supported are already in that list, but custom volumes will need to be added by you. We suggest mounting custom storage volumes outside of `/var/www/html` and if possible read-only so that making this adjustment is unnecessary. If you must do so, however, you may build a custom image with a modified `/upgrade.exclude` file that incorporates your custom volume(s).
## Running as an arbitrary user / file permissions / changing the default container user
The default user within a container is root (uid = 0). By default, processes inside the container will expect to have root privileges. Network services will drop privileges and use `www-data` to serve requests.
Depending on your volumes configuration, this can lead to permission issues. You can address this by running the container with a different default user. When changing the default user, the image will no longer assume it has root privileges and will run all processes under the specified uid. To accomplish this, use the `--user` / `user` option in your container environment.
See:
- https://docs.docker.com/engine/containers/run/#user
- https://github.com/docker-library/docs/tree/master/php#running-as-an-arbitrary-user
- https://docs.podman.io/en/stable/markdown/podman-run.1.html#user-u-user-group
## Accessing the Nextcloud command-line interface (`occ`) ## Accessing the Nextcloud command-line interface (`occ`)
To use the [Nextcloud command-line interface](https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/occ_command.html) (aka. `occ` command): To use the [Nextcloud command-line interface](https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/occ_command.html) (aka. `occ` command):
```console ```console
$ docker exec -it --user www-data CONTAINER_ID php occ $ docker exec --user www-data CONTAINER_ID php occ
``` ```
or for docker compose: or for docker compose:
```console ```console
@ -247,7 +236,6 @@ To use Redis for memory caching as well as PHP session storage, specify the foll
- `REDIS_HOST` (not set by default) Name of Redis container - `REDIS_HOST` (not set by default) Name of Redis container
- `REDIS_HOST_PORT` (default: `6379`) Optional port for Redis, only use for external Redis servers that run on non-standard ports. - `REDIS_HOST_PORT` (default: `6379`) Optional port for Redis, only use for external Redis servers that run on non-standard ports.
- `REDIS_HOST_USER` (not set by default) Optional username for Redis, only use for external Redis servers that require a user.
- `REDIS_HOST_PASSWORD` (not set by default) Redis password - `REDIS_HOST_PASSWORD` (not set by default) Redis password
Check the [Nextcloud documentation](https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/caching_configuration.html) for more information. Check the [Nextcloud documentation](https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/caching_configuration.html) for more information.
@ -320,7 +308,6 @@ Check the [Nextcloud documentation](https://docs.nextcloud.com/server/latest/adm
To customize PHP limits you can change the following variables: To customize PHP limits you can change the following variables:
- `PHP_MEMORY_LIMIT` (default `512M`) This sets the maximum amount of memory in bytes that a script is allowed to allocate. This is meant to help prevent poorly written scripts from eating up all available memory but it can prevent normal operation if set too tight. - `PHP_MEMORY_LIMIT` (default `512M`) This sets the maximum amount of memory in bytes that a script is allowed to allocate. This is meant to help prevent poorly written scripts from eating up all available memory but it can prevent normal operation if set too tight.
- `PHP_UPLOAD_LIMIT` (default `512M`) This sets the upload limit (`post_max_size` and `upload_max_filesize`) for big files. Note that you may have to change other limits depending on your client, webserver or operating system. Check the [Nextcloud documentation](https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/big_file_upload_configuration.html) for more information. - `PHP_UPLOAD_LIMIT` (default `512M`) This sets the upload limit (`post_max_size` and `upload_max_filesize`) for big files. Note that you may have to change other limits depending on your client, webserver or operating system. Check the [Nextcloud documentation](https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/big_file_upload_configuration.html) for more information.
- `PHP_OPCACHE_MEMORY_CONSUMPTION` (default `128`) This sets the `opcache.memory_consumption` value. It's the size of the shared memory storage used by OPcache, in megabytes.
### Apache Configuration ### Apache Configuration
@ -415,7 +402,7 @@ services:
db: db:
image: mariadb:10.11 image: mariadb:10.11
restart: always restart: always
command: --transaction-isolation=READ-COMMITTED command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW
volumes: volumes:
- db:/var/lib/mysql - db:/var/lib/mysql
environment: environment:
@ -463,7 +450,7 @@ services:
db: db:
image: mariadb:10.11 image: mariadb:10.11
restart: always restart: always
command: --transaction-isolation=READ-COMMITTED command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW
volumes: volumes:
- db:/var/lib/mysql - db:/var/lib/mysql
environment: environment:

View file

@ -23,39 +23,32 @@ run_as() {
run_path() { run_path() {
local hook_folder_path="/docker-entrypoint-hooks.d/$1" local hook_folder_path="/docker-entrypoint-hooks.d/$1"
local return_code=0 local return_code=0
local found=0
echo "=> Searching for hook scripts (*.sh) to run, located in the folder \"${hook_folder_path}\"" if ! [ -d "${hook_folder_path}" ]; then
echo "=> Skipping the folder \"${hook_folder_path}\", because it doesn't exist"
if ! [ -d "${hook_folder_path}" ] || directory_empty "${hook_folder_path}"; then
echo "==> Skipped: the \"$1\" folder is empty (or does not exist)"
return 0 return 0
fi fi
find "${hook_folder_path}" -maxdepth 1 -iname '*.sh' '(' -type f -o -type l ')' -print | sort | ( echo "=> Searching for scripts (*.sh) to run, located in the folder: ${hook_folder_path}"
while read -r script_file_path; do
(
find "${hook_folder_path}" -maxdepth 1 -iname '*.sh' '(' -type f -o -type l ')' -print | sort | while read -r script_file_path; do
if ! [ -x "${script_file_path}" ]; then if ! [ -x "${script_file_path}" ]; then
echo "==> The script \"${script_file_path}\" was skipped, because it lacks the executable flag" echo "==> The script \"${script_file_path}\" was skipped, because it didn't have the executable flag"
found=$((found-1))
continue continue
fi fi
echo "==> Running the script (cwd: $(pwd)): \"${script_file_path}\"" echo "==> Running the script (cwd: $(pwd)): \"${script_file_path}\""
found=$((found+1))
run_as "${script_file_path}" || return_code="$?" run_as "${script_file_path}" || return_code="$?"
if [ "${return_code}" -ne "0" ]; then if [ "${return_code}" -ne "0" ]; then
echo "==> Failed at executing script \"${script_file_path}\". Exit code: ${return_code}" echo "==> Failed at executing \"${script_file_path}\". Exit code: ${return_code}"
exit 1 exit 1
fi fi
echo "==> Finished executing the script: \"${script_file_path}\"" echo "==> Finished the script: \"${script_file_path}\""
done done
if [ "$found" -lt "1" ]; then
echo "==> Skipped: the \"$1\" folder does not contain any valid scripts"
else
echo "=> Completed executing scripts in the \"$1\" folder"
fi
) )
} }
@ -121,21 +114,13 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
# check if redis host is an unix socket path # check if redis host is an unix socket path
if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then
if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
if [ -n "${REDIS_HOST_USER+x}" ]; then
echo "session.save_path = \"unix://${REDIS_HOST}?auth[]=${REDIS_HOST_USER}&auth[]=${REDIS_HOST_PASSWORD}\""
else
echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_HOST_PASSWORD}\"" echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_HOST_PASSWORD}\""
fi
else else
echo "session.save_path = \"unix://${REDIS_HOST}\"" echo "session.save_path = \"unix://${REDIS_HOST}\""
fi fi
# check if redis password has been set # check if redis password has been set
elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then elif [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
if [ -n "${REDIS_HOST_USER+x}" ]; then
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth[]=${REDIS_HOST_USER}&auth[]=${REDIS_HOST_PASSWORD}\""
else
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\"" echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}\""
fi
else else
echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\"" echo "session.save_path = \"tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}\""
fi fi
@ -252,14 +237,12 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
fi fi
if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then if [ -n "${NEXTCLOUD_TRUSTED_DOMAINS+x}" ]; then
echo "Setting trusted domains…" echo "Setting trusted domains…"
set -f # turn off glob
NC_TRUSTED_DOMAIN_IDX=1 NC_TRUSTED_DOMAIN_IDX=1
for DOMAIN in ${NEXTCLOUD_TRUSTED_DOMAINS}; do for DOMAIN in $NEXTCLOUD_TRUSTED_DOMAINS ; do
DOMAIN=$(echo "${DOMAIN}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') DOMAIN=$(echo "$DOMAIN" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=\"${DOMAIN}\"" run_as "php /var/www/html/occ config:system:set trusted_domains $NC_TRUSTED_DOMAIN_IDX --value=$DOMAIN"
NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1)) NC_TRUSTED_DOMAIN_IDX=$((NC_TRUSTED_DOMAIN_IDX+1))
done done
set +f # turn glob back on
fi fi
run_path post-installation run_path post-installation

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -Eeuo pipefail set -Eeuo pipefail
stable_channel='31.0.4' stable_channel='30.0.4'
self="$(basename "$BASH_SOURCE")" self="$(basename "$BASH_SOURCE")"
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"

View file

@ -1 +1 @@
31.0.4 30.0.4

View file

@ -2,7 +2,7 @@
set -eo pipefail set -eo pipefail
declare -A alpine_version=( declare -A alpine_version=(
[default]='3.21' [default]='3.20'
) )
declare -A debian_version=( declare -A debian_version=(
@ -44,24 +44,6 @@ apcu_version="$(
| tail -1 | tail -1
)" )"
igbinary_version="$(
git ls-remote --tags https://github.com/igbinary/igbinary.git \
| cut -d/ -f3 \
| grep -viE '[a-z]' \
| tr -d '^{}' \
| sort -V \
| tail -1
)"
imagick_version="$(
git ls-remote --tags https://github.com/imagick/imagick.git \
| cut -d/ -f3 \
| grep -viE '[a-z]' \
| tr -d '^{}' \
| sort -V \
| tail -1
)"
memcached_version="$( memcached_version="$(
git ls-remote --tags https://github.com/php-memcached-dev/php-memcached.git \ git ls-remote --tags https://github.com/php-memcached-dev/php-memcached.git \
| cut -d/ -f3 \ | cut -d/ -f3 \
@ -80,12 +62,20 @@ redis_version="$(
| tail -1 | tail -1
)" )"
imagick_version="$(
git ls-remote --tags https://github.com/mkoppanen/imagick.git \
| cut -d/ -f3 \
| grep -viE '[a-z]' \
| tr -d '^{}' \
| sort -V \
| tail -1
)"
declare -A pecl_versions=( declare -A pecl_versions=(
[APCu]="$apcu_version" [APCu]="$apcu_version"
[igbinary]="$igbinary_version"
[imagick]="$imagick_version"
[memcached]="$memcached_version" [memcached]="$memcached_version"
[redis]="$redis_version" [redis]="$redis_version"
[imagick]="$imagick_version"
) )
variants=( variants=(
@ -94,7 +84,7 @@ variants=(
fpm-alpine fpm-alpine
) )
min_version='29' min_version='28'
# version_greater_or_equal A B returns whether A >= B # version_greater_or_equal A B returns whether A >= B
function version_greater_or_equal() { function version_greater_or_equal() {
@ -131,10 +121,9 @@ function create_variant() {
s/%%CMD%%/'"${cmd[$variant]}"'/g; s/%%CMD%%/'"${cmd[$variant]}"'/g;
s|%%VARIANT_EXTRAS%%|'"${extras[$variant]}"'|g; s|%%VARIANT_EXTRAS%%|'"${extras[$variant]}"'|g;
s/%%APCU_VERSION%%/'"${pecl_versions[APCu]}"'/g; s/%%APCU_VERSION%%/'"${pecl_versions[APCu]}"'/g;
s/%%IGBINARY_VERSION%%/'"${pecl_versions[igbinary]}"'/g;
s/%%IMAGICK_VERSION%%/'"${pecl_versions[imagick]}"'/g;
s/%%MEMCACHED_VERSION%%/'"${pecl_versions[memcached]}"'/g; s/%%MEMCACHED_VERSION%%/'"${pecl_versions[memcached]}"'/g;
s/%%REDIS_VERSION%%/'"${pecl_versions[redis]}"'/g; s/%%REDIS_VERSION%%/'"${pecl_versions[redis]}"'/g;
s/%%IMAGICK_VERSION%%/'"${pecl_versions[imagick]}"'/g;
s/%%CRONTAB_INT%%/'"$crontabInt"'/g; s/%%CRONTAB_INT%%/'"$crontabInt"'/g;
' "$dir/Dockerfile" ' "$dir/Dockerfile"

View file

@ -1,35 +1,9 @@
{ {
"31": {
"branch": "31",
"version": "31.0.4",
"url": "https://download.nextcloud.com/server/releases/nextcloud-31.0.4.tar.bz2",
"ascUrl": "https://download.nextcloud.com/server/releases/nextcloud-31.0.4.tar.bz2.asc",
"variants": {
"apache": {
"variant": "apache",
"base": "debian",
"baseVersion": "bookworm",
"phpVersion": "8.2"
},
"fpm": {
"variant": "fpm",
"base": "debian",
"baseVersion": "bookworm",
"phpVersion": "8.2"
},
"fpm-alpine": {
"variant": "fpm-alpine",
"base": "alpine",
"baseVersion": "3.21",
"phpVersion": "8.2"
}
}
},
"30": { "30": {
"branch": "30", "branch": "30",
"version": "30.0.10", "version": "30.0.4",
"url": "https://download.nextcloud.com/server/releases/nextcloud-30.0.10.tar.bz2", "url": "https://download.nextcloud.com/server/releases/nextcloud-30.0.4.tar.bz2",
"ascUrl": "https://download.nextcloud.com/server/releases/nextcloud-30.0.10.tar.bz2.asc", "ascUrl": "https://download.nextcloud.com/server/releases/nextcloud-30.0.4.tar.bz2.asc",
"variants": { "variants": {
"apache": { "apache": {
"variant": "apache", "variant": "apache",
@ -46,16 +20,16 @@
"fpm-alpine": { "fpm-alpine": {
"variant": "fpm-alpine", "variant": "fpm-alpine",
"base": "alpine", "base": "alpine",
"baseVersion": "3.21", "baseVersion": "3.20",
"phpVersion": "8.2" "phpVersion": "8.2"
} }
} }
}, },
"29": { "29": {
"branch": "29", "branch": "29",
"version": "29.0.16", "version": "29.0.10",
"url": "https://download.nextcloud.com/server/releases/nextcloud-29.0.16.tar.bz2", "url": "https://download.nextcloud.com/server/releases/nextcloud-29.0.10.tar.bz2",
"ascUrl": "https://download.nextcloud.com/server/releases/nextcloud-29.0.16.tar.bz2.asc", "ascUrl": "https://download.nextcloud.com/server/releases/nextcloud-29.0.10.tar.bz2.asc",
"variants": { "variants": {
"apache": { "apache": {
"variant": "apache", "variant": "apache",
@ -72,7 +46,33 @@
"fpm-alpine": { "fpm-alpine": {
"variant": "fpm-alpine", "variant": "fpm-alpine",
"base": "alpine", "base": "alpine",
"baseVersion": "3.21", "baseVersion": "3.20",
"phpVersion": "8.2"
}
}
},
"28": {
"branch": "28",
"version": "28.0.14",
"url": "https://download.nextcloud.com/server/releases/nextcloud-28.0.14.tar.bz2",
"ascUrl": "https://download.nextcloud.com/server/releases/nextcloud-28.0.14.tar.bz2.asc",
"variants": {
"apache": {
"variant": "apache",
"base": "debian",
"baseVersion": "bookworm",
"phpVersion": "8.2"
},
"fpm": {
"variant": "fpm",
"base": "debian",
"baseVersion": "bookworm",
"phpVersion": "8.2"
},
"fpm-alpine": {
"variant": "fpm-alpine",
"base": "alpine",
"baseVersion": "3.20",
"phpVersion": "8.2" "phpVersion": "8.2"
} }
} }