From f383ff4324c5fdb5ca115f1a15899cbab0689014 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnau=20V=C3=A0zquez=20Palma?= Date: Fri, 12 Feb 2021 12:39:05 +0100 Subject: [PATCH 1/5] Working concept with news + eelo theme --- Dockerfile | 35 ++++++++++++++++++++++++++++++----- custom_entrypoint.sh | 17 +++++++++++++++++ 2 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 custom_entrypoint.sh diff --git a/Dockerfile b/Dockerfile index 64eda945..787e8f64 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,33 @@ FROM nextcloud:19.0.8-fpm +ARG BASE_DIR="/usr/src/nextcloud" +ARG THEME_VERSION="19.0.8.2" +ARG NEWS_VERSION="14.2.2" + RUN mkdir -p /var/www/skeleton/Documents && mkdir -p /var/www/skeleton/Images COPY patches/ /tmp/build_patches/ -RUN sed -i 's/19,0,8,1/19,0,8,2/g' /usr/src/nextcloud/version.php -#RUN patch -u /usr/src/nextcloud/core/signature.json -i /tmp/build_patches/001-sha512-signature.patch -RUN patch -u /usr/src/nextcloud/core/Controller/LoginController.php -i /tmp/build_patches/002-login-without-domain.patch -RUN patch -u /usr/src/nextcloud/core/templates/layout.user.php -i /tmp/build_patches/003-contact-search-removal.patch -RUN patch -u /usr/src/nextcloud/core/Controller/ContactsMenuController.php -i /tmp/build_patches/004-contact-search-controller-removal.patch \ No newline at end of file +COPY custom_entrypoint.sh / +RUN chmod +x /custom_entrypoint.sh +RUN sed -i 's/19,0,8,1/19,0,8,3/' ${BASE_DIR}/version.php + +# Patches +#RUN patch -u ${BASE_DIR}/core/signature.json -i /tmp/build_patches/001-sha512-signature.patch +RUN patch -u ${BASE_DIR}/core/Controller/LoginController.php -i /tmp/build_patches/002-login-without-domain.patch +RUN patch -u ${BASE_DIR}/core/templates/layout.user.php -i /tmp/build_patches/003-contact-search-removal.patch +RUN patch -u ${BASE_DIR}/core/Controller/ContactsMenuController.php -i /tmp/build_patches/004-contact-search-controller-removal.patch +RUN rm -rf /tmp/build_patches/ + +# Custom apps +RUN curl -fsSL -o news.tar.gz \ + "https://github.com/nextcloud/news/releases/download/${NEWS_VERSION}/news.tar.gz" && \ + tar -xf news.tar.gz -C ${BASE_DIR}/custom_apps/ && \ + rm news.tar.gz; + +# Custom theme +RUN curl -fsSL -o eelo-theme.tar.gz \ + "https://gitlab.e.foundation/e/infra/nextcloud-theme/-/archive/${THEME_VERSION}/nextcloud-theme-${THEME_VERSION}.tar.gz" && \ + tar -xf eelo-theme.tar.gz -C /tmp/ && \ + mv /tmp/nextcloud-theme-${THEME_VERSION}/eelo ${BASE_DIR}/themes/ && \ + rm -rf eelo-theme.tar.gz /tmp/nextcloud-theme-* ${BASE_DIR}/themes/example/ + +ENTRYPOINT ["/custom_entrypoint.sh"] +CMD ["php-fpm"] \ No newline at end of file diff --git a/custom_entrypoint.sh b/custom_entrypoint.sh new file mode 100644 index 00000000..e0613288 --- /dev/null +++ b/custom_entrypoint.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +echo "Custom eCloud entrypoint" + +if [ "$(id -u)" = 0 ]; then + rsync_options="-rlDog --chown www-data:www-data" +else + rsync_options="-rlD" +fi + +for dir in custom_apps themes; do + echo "Updating ${dir}" + rsync $rsync_options --include "/usr/src/nextcloud/$dir/" /usr/src/nextcloud/ /var/www/html/ +done + +/entrypoint.sh "$@" +echo "bye bye NC" \ No newline at end of file -- GitLab From 6f48ac7a932b9d098940fef4a74bee2ce402288b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnau=20V=C3=A0zquez=20Palma?= Date: Fri, 12 Feb 2021 13:44:22 +0100 Subject: [PATCH 2/5] Fix rsync syntax to: - remove no longer existing files - iterate only on the affected apps and themes --- custom_entrypoint.sh | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/custom_entrypoint.sh b/custom_entrypoint.sh index e0613288..548895fb 100644 --- a/custom_entrypoint.sh +++ b/custom_entrypoint.sh @@ -1,17 +1,10 @@ #!/bin/sh echo "Custom eCloud entrypoint" +rsync_options="-rvlDog --chown www-data:www-data --delete" -if [ "$(id -u)" = 0 ]; then - rsync_options="-rlDog --chown www-data:www-data" -else - rsync_options="-rlD" -fi - -for dir in custom_apps themes; do - echo "Updating ${dir}" - rsync $rsync_options --include "/usr/src/nextcloud/$dir/" /usr/src/nextcloud/ /var/www/html/ -done +rsync $rsync_options --include "/news/" --exclude '/*' /usr/src/nextcloud/custom_apps/ /var/www/html/custom_apps/ +rsync $rsync_options --include "/eelo/" --exclude '/*' /usr/src/nextcloud/themes/ /var/www/html/themes/ /entrypoint.sh "$@" echo "bye bye NC" \ No newline at end of file -- GitLab From 3c6435169497c1120812a9c033fac720dee6e127 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnau=20V=C3=A0zquez=20Palma?= Date: Fri, 12 Feb 2021 13:51:52 +0100 Subject: [PATCH 3/5] Chown before rsync and remove verbosity. --- Dockerfile | 1 + custom_entrypoint.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 787e8f64..33db6b76 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,6 +27,7 @@ RUN curl -fsSL -o eelo-theme.tar.gz \ "https://gitlab.e.foundation/e/infra/nextcloud-theme/-/archive/${THEME_VERSION}/nextcloud-theme-${THEME_VERSION}.tar.gz" && \ tar -xf eelo-theme.tar.gz -C /tmp/ && \ mv /tmp/nextcloud-theme-${THEME_VERSION}/eelo ${BASE_DIR}/themes/ && \ + chown -R www-data:www-data ${BASE_DIR}/themes/eelo/ && \ rm -rf eelo-theme.tar.gz /tmp/nextcloud-theme-* ${BASE_DIR}/themes/example/ ENTRYPOINT ["/custom_entrypoint.sh"] diff --git a/custom_entrypoint.sh b/custom_entrypoint.sh index 548895fb..cf055cd9 100644 --- a/custom_entrypoint.sh +++ b/custom_entrypoint.sh @@ -1,7 +1,7 @@ #!/bin/sh echo "Custom eCloud entrypoint" -rsync_options="-rvlDog --chown www-data:www-data --delete" +rsync_options="-rlDog --chown www-data:www-data --delete" rsync $rsync_options --include "/news/" --exclude '/*' /usr/src/nextcloud/custom_apps/ /var/www/html/custom_apps/ rsync $rsync_options --include "/eelo/" --exclude '/*' /usr/src/nextcloud/themes/ /var/www/html/themes/ -- GitLab From bff615c885df8f5d9a2929ed609dcc9b44729b6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnau=20V=C3=A0zquez=20Palma?= Date: Fri, 12 Feb 2021 13:58:02 +0100 Subject: [PATCH 4/5] Bump version number. --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 33db6b76..25fa9628 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ RUN mkdir -p /var/www/skeleton/Documents && mkdir -p /var/www/skeleton/Images COPY patches/ /tmp/build_patches/ COPY custom_entrypoint.sh / RUN chmod +x /custom_entrypoint.sh -RUN sed -i 's/19,0,8,1/19,0,8,3/' ${BASE_DIR}/version.php +RUN sed -i 's/19,0,8,1/19,0,8,4/' ${BASE_DIR}/version.php # Patches #RUN patch -u ${BASE_DIR}/core/signature.json -i /tmp/build_patches/001-sha512-signature.patch -- GitLab From 48ab36e3b305196b734f0261962fbc6c0726ff02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnau=20V=C3=A0zquez=20Palma?= Date: Fri, 12 Feb 2021 14:06:06 +0100 Subject: [PATCH 5/5] Revert "Bump version number." This reverts commit bff615c8 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 25fa9628..33db6b76 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ RUN mkdir -p /var/www/skeleton/Documents && mkdir -p /var/www/skeleton/Images COPY patches/ /tmp/build_patches/ COPY custom_entrypoint.sh / RUN chmod +x /custom_entrypoint.sh -RUN sed -i 's/19,0,8,1/19,0,8,4/' ${BASE_DIR}/version.php +RUN sed -i 's/19,0,8,1/19,0,8,3/' ${BASE_DIR}/version.php # Patches #RUN patch -u ${BASE_DIR}/core/signature.json -i /tmp/build_patches/001-sha512-signature.patch -- GitLab