Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions dappnode_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,14 @@
{
"arg": "UPSTREAM_VERSION",
"repo": "nextcloud/server",
"version": "34.0.1"
"version": "34.0.2"
}
],
"version": "0.1.1"
"globalEnvs": [
{
"envs": ["_DAPPNODE_GLOBAL_DOMAIN"],
"services": ["nextcloud"]
}
],
"version": "0.2.0"
}
5 changes: 5 additions & 0 deletions nextcloud/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,8 @@ RUN { \
} > /usr/src/nextcloud/config/redis.config.php

EXPOSE 8034

COPY entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh

ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
22 changes: 22 additions & 0 deletions nextcloud/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
set -e

CONFIG_FILE="/var/www/html/config/config.php"

if [ -n "${_DAPPNODE_GLOBAL_DOMAIN}" ]; then
if [ -f "${CONFIG_FILE}" ]; then
# Nextcloud already installed -> patch trusted_domains in config.php directly
EXISTING_DOMAINS=$(su -s /bin/bash www-data -c "php occ config:system:get trusted_domains" 2>/dev/null || true)

if ! printf '%s\n' "${EXISTING_DOMAINS}" | grep -qx "${_DAPPNODE_GLOBAL_DOMAIN}"; then
NEXT_INDEX=$(printf '%s\n' "${EXISTING_DOMAINS}" | grep -c . )
su -s /bin/bash www-data -c "php occ config:system:set trusted_domains ${NEXT_INDEX} --value=${_DAPPNODE_GLOBAL_DOMAIN}"
fi
else
# First run -> config.php doesn't exist yet, let the official install create it
export NEXTCLOUD_TRUSTED_DOMAINS="${NEXTCLOUD_TRUSTED_DOMAINS:-nextcloud.dappnode} ${_DAPPNODE_GLOBAL_DOMAIN}"
fi
fi

# Hand off to the official Nextcloud entrypoint
exec /entrypoint.sh apache2-foreground