From 1d062278e5b97b53569aa42fdc3d467598c75b66 Mon Sep 17 00:00:00 2001 From: Akhil Date: Mon, 31 Oct 2022 19:31:44 +0530 Subject: [PATCH 1/4] Selfhost builds auto-build --- .gitlab-ci.yml | 44 +++++++++++++++++++++++------- Dockerfile | 73 ++++++++++++++++++++++++++++++++------------------ 2 files changed, 82 insertions(+), 35 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1e9fa46e..3be72010 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -10,23 +10,49 @@ default: services: - docker:19.03.12-dind before_script: - - docker info - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY tags: - generic_privileged +.build-docker: + script: + - echo "TARGET $TARGET, BRANCH $CI_COMMIT_BRANCH, COMMIT_REF_SLUG $CI_COMMIT_REF_SLUG, COMMIT_TAG $CI_COMMIT_TAG" + - docker build --target $TARGET --pull -t "$CI_REGISTRY_IMAGE$SUBPATH:$CI_COMMIT_REF_SLUG" . + - docker push "$CI_REGISTRY_IMAGE$SUBPATH:$CI_COMMIT_REF_SLUG" + build-branch: - except: - - tags stage: build - script: - - docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" . - - docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" + variables: + TARGET: ecloud + SUBPATH: '' + only: + - branches + extends: .build-docker + +build-branch-selfhost: + stage: build + variables: + TARGET: selfhost + SUBPATH: '/selfhost' + only: + - branches + when: manual + extends: .build-docker build-tag: + stage: build + variables: + TARGET: ecloud + SUBPATH: '' only: - tags + extends: .build-docker + +build-tag-selfhost: stage: build - script: - - docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG" . - - docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG" + variables: + TARGET: selfhost + SUBPATH: '/selfhost' + only: + - tags + extends: .build-docker diff --git a/Dockerfile b/Dockerfile index d6abb495..7ac4e4cf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,14 @@ FROM nextcloud:23.0.9-fpm AS nextcloud ARG BASE_DIR="/usr/src/nextcloud" ARG TMP_PATCH_DIR="/tmp/build_patches" -ARG THEME_VERSION="22.1.5" +ARG THEME_VERSION="23.0.1" +ARG SELFHOST_THEME_VERSION="selfhost-22.0.0" ARG THEME_HELPER_VERSION="1.4.4" ARG NEWS_VERSION="18.1.1" ARG QUOTA_WARN_VERSION="1.14.0" ARG NOTES_VERSION="4.5.1" ARG CONTACTS_JOB_ID="400045" -ARG CALENDAR_JOB_ID="414851" +ARG CALENDAR_JOB_ID="413645" ARG USER_BACKEND_RAW_SQL_VERSION="1.3.0" ARG EMAIL_RECOVERY_JOB_ID="389385" ARG RAINLOOP_VERSION="7.2.5" @@ -97,15 +98,6 @@ RUN curl -fsSL -o ecloud-accounts.tar.gz \ mv "${BASE_DIR}/custom_apps/ecloud-accounts-${EA_TAG}" "${BASE_DIR}/custom_apps/ecloud-accounts" && \ rm ecloud-accounts.tar.gz; -RUN curl -fsSL -o ldap_write_support.tar.gz \ - "https://github.com/nextcloud-releases/ldap_write_support/releases/download/v${LDAP_WRITE_SUPPORT_VERSION}/ldap_write_support.tar.gz" && \ - tar -xf ldap_write_support.tar.gz -C ${BASE_DIR}/custom_apps && \ - rm ldap_write_support.tar.gz - -RUN curl -fsSL -o oidc_login.tar.gz \ - "https://github.com/pulsejet/nextcloud-oidc-login/releases/download/v${OIDC_LOGIN_VERSION}/oidc_login.tar.gz" && \ - tar -xf oidc_login.tar.gz -C ${BASE_DIR}/custom_apps && \ - rm oidc_login.tar.gz # Remove unzip when unzipping is done RUN apt-get -y remove unzip @@ -113,13 +105,16 @@ RUN apt-get -y remove unzip # force eCloud theme not to be disabled even when there is an upgrade process launched RUN sed -i "s/\$systemConfig->setValue('theme', '');/\$systemConfig->setValue('theme', 'eCloud');/g" ${BASE_DIR}/lib/base.php +ENTRYPOINT ["/custom_entrypoint.sh"] +CMD ["php-fpm"] + +From nextcloud as selfhost +ARG BASE_DIR="/usr/src/nextcloud" +ARG TMP_PATCH_DIR="/tmp/build_patches" + # Patches COPY patches/ ${TMP_PATCH_DIR}/ RUN cd ${BASE_DIR} && patch -p0 < ${TMP_PATCH_DIR}/002-login-without-domain.patch -RUN patch -u ${BASE_DIR}/core/templates/layout.user.php -i ${TMP_PATCH_DIR}/003-contact-search-removal.patch -RUN patch -u ${BASE_DIR}/core/Controller/ContactsMenuController.php -i ${TMP_PATCH_DIR}/004-contact-search-controller-removal.patch -RUN cd ${BASE_DIR} && patch -p0 < ${TMP_PATCH_DIR}/005-autocomplete-user-leak-core.patch -RUN cd ${BASE_DIR}/custom_apps && patch -p0 < ${TMP_PATCH_DIR}/005-autocomplete-user-leak-custom-app.patch RUN cd ${BASE_DIR} && patch -p0 < ${TMP_PATCH_DIR}/006-recovery-email-changes.patch RUN patch -u ${BASE_DIR}/apps/settings/lib/Settings/Personal/ServerDevNotice.php -i ${TMP_PATCH_DIR}/007-remove-dev-notice.patch RUN patch -u ${BASE_DIR}/lib/private/Template/IconsCacher.php -i ${TMP_PATCH_DIR}/008-icons-cacher-theme-svgs.patch @@ -127,17 +122,51 @@ RUN patch -u ${BASE_DIR}/core/Controller/SvgController.php -i ${TMP_PATCH_DIR}/0 RUN cd ${BASE_DIR} && patch -p0 < ${TMP_PATCH_DIR}/009-help-links.patch RUN patch -u ${BASE_DIR}/lib/private/Updater.php -i ${TMP_PATCH_DIR}/010-disable-app-store-upgrade.patch RUN cd ${BASE_DIR} && patch -p0 < ${TMP_PATCH_DIR}/011-privacy-settings.patch -RUN cd ${BASE_DIR} && patch -u ${BASE_DIR}/apps/dashboard/lib/Controller/DashboardController.php -i ${TMP_PATCH_DIR}/012-remove-user-status-widget.patch RUN patch -u ${BASE_DIR}/lib/private/Authentication/Token/PublicKeyTokenProvider.php -i ${TMP_PATCH_DIR}/013-revert-token-password-update.patch RUN patch -u ${BASE_DIR}/lib/private/legacy/OC_Helper.php -i ${TMP_PATCH_DIR}/014-add-mail-usage.patch RUN cd ${BASE_DIR} && patch -u ${BASE_DIR}/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php -i ${TMP_PATCH_DIR}/015-email-mail-template.patch -RUN patch -u ${BASE_DIR}/core/templates/layout.guest.php -i ${TMP_PATCH_DIR}/016-login-screen.patch RUN patch -u ${BASE_DIR}/core/Command/User/Setting.php -i ${TMP_PATCH_DIR}/018-occ-user-setting.patch RUN patch -u ${BASE_DIR}/apps/settings/lib/Sections/Personal/Groupware.php -i ${TMP_PATCH_DIR}/019-groupware.patch -RUN patch -u ${BASE_DIR}/lib/private/Notification/Manager.php -i ${TMP_PATCH_DIR}/020-fairuse-notification-fix.patch RUN patch -u ${BASE_DIR}/apps/files/js/files.js -i ${TMP_PATCH_DIR}/021-repeated-storage-dialog-fix.patch RUN rm -rf ${TMP_PATCH_DIR} +# Custom theme +RUN curl -fsSL -o eCloud-theme.tar.gz \ + "https://gitlab.e.foundation/e/infra/ecloud/nextcloud-apps/nextcloud-theme/-/archive/${SELFHOST_THEME_VERSION}/nextcloud-theme-${SELFHOST_THEME_VERSION}.tar.gz" && \ + tar -xf eCloud-theme.tar.gz -C /tmp/ && \ + mv /tmp/nextcloud-theme-${THEME_VERSION}/ ${BASE_DIR}/themes/eCloud && \ + chown -R www-data:www-data ${BASE_DIR}/themes/eCloud/ && \ + rm -rf eCloud-theme.tar.gz ${BASE_DIR}/themes/example/ + +# Replace "Get your own free account" NC link with /e/ Account link in public pages +RUN sed -i 's/https:\/\/nextcloud.com\/signup\//https:\/\/e\.foundation\/\/e-email-invite\//' ${BASE_DIR}/core/templates/layout.public.php +# Set default class of hidden to settings-hint +RUN sed -i 's/settings-hint/settings-hint hidden/' ${BASE_DIR}/apps/settings/templates/settings/personal/security/twofactor.php + +From selfhost as ecloud +ARG BASE_DIR="/usr/src/nextcloud" +ARG TMP_PATCH_DIR="/tmp/build_patches" +# Patches +COPY patches/ ${TMP_PATCH_DIR}/ +RUN patch -u ${BASE_DIR}/core/templates/layout.user.php -i ${TMP_PATCH_DIR}/003-contact-search-removal.patch +RUN patch -u ${BASE_DIR}/core/Controller/ContactsMenuController.php -i ${TMP_PATCH_DIR}/004-contact-search-controller-removal.patch +RUN cd ${BASE_DIR} && patch -p0 < ${TMP_PATCH_DIR}/005-autocomplete-user-leak-core.patch +RUN cd ${BASE_DIR}/custom_apps && patch -p0 < ${TMP_PATCH_DIR}/005-autocomplete-user-leak-custom-app.patch +RUN cd ${BASE_DIR} && patch -u ${BASE_DIR}/apps/dashboard/lib/Controller/DashboardController.php -i ${TMP_PATCH_DIR}/012-remove-user-status-widget.patch +RUN patch -u ${BASE_DIR}/core/templates/layout.guest.php -i ${TMP_PATCH_DIR}/016-login-screen.patch +RUN patch -u ${BASE_DIR}/lib/private/Notification/Manager.php -i ${TMP_PATCH_DIR}/020-fairuse-notification-fix.patch +RUN rm -rf ${TMP_PATCH_DIR} + +RUN curl -fsSL -o ldap_write_support.tar.gz \ + "https://github.com/nextcloud-releases/ldap_write_support/releases/download/v${LDAP_WRITE_SUPPORT_VERSION}/ldap_write_support.tar.gz" && \ + tar -xf ldap_write_support.tar.gz -C ${BASE_DIR}/custom_apps && \ + rm ldap_write_support.tar.gz + +RUN curl -fsSL -o oidc_login.tar.gz \ + "https://github.com/pulsejet/nextcloud-oidc-login/releases/download/v${OIDC_LOGIN_VERSION}/oidc_login.tar.gz" && \ + tar -xf oidc_login.tar.gz -C ${BASE_DIR}/custom_apps && \ + rm oidc_login.tar.gz + # show reset pwd page with a query param RUN cd ${BASE_DIR}/core/js/dist && sed -i 's/resetPassword:!1/resetPassword:!1||Z.showResetPassword==="1"/' login.js @@ -176,15 +205,7 @@ RUN curl -fsSL -o eCloud-theme.tar.gz \ chown -R www-data:www-data ${BASE_DIR}/themes/eCloud/ && \ rm -rf eCloud-theme.tar.gz ${BASE_DIR}/themes/example/ -# Replace "Get your own free account" NC link with /e/ Account link in public pages -RUN sed -i 's/https:\/\/nextcloud.com\/signup\//https:\/\/e\.foundation\/\/e-email-invite\//' ${BASE_DIR}/core/templates/layout.public.php - -# Set default class of hidden to settings-hint -RUN sed -i 's/settings-hint/settings-hint hidden/' ${BASE_DIR}/apps/settings/templates/settings/personal/security/twofactor.php - # Seds to fix displayname save regression RUN sed -i "s/'email' ||/'email'/" ${BASE_DIR}/apps/settings/js/federationsettingsview.js RUN sed -i "s/field === 'displayname'//" ${BASE_DIR}/apps/settings/js/federationsettingsview.js -ENTRYPOINT ["/custom_entrypoint.sh"] -CMD ["php-fpm"] -- GitLab From 0a04262a2a932c2aaf6805f01bf18a99864fb0fd Mon Sep 17 00:00:00 2001 From: Akhil Date: Mon, 31 Oct 2022 19:41:38 +0530 Subject: [PATCH 2/4] fix theme --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 7ac4e4cf..748d5799 100644 --- a/Dockerfile +++ b/Dockerfile @@ -134,7 +134,7 @@ RUN rm -rf ${TMP_PATCH_DIR} RUN curl -fsSL -o eCloud-theme.tar.gz \ "https://gitlab.e.foundation/e/infra/ecloud/nextcloud-apps/nextcloud-theme/-/archive/${SELFHOST_THEME_VERSION}/nextcloud-theme-${SELFHOST_THEME_VERSION}.tar.gz" && \ tar -xf eCloud-theme.tar.gz -C /tmp/ && \ - mv /tmp/nextcloud-theme-${THEME_VERSION}/ ${BASE_DIR}/themes/eCloud && \ + mv /tmp/nextcloud-theme-${SELFHOST_THEME_VERSION}/ ${BASE_DIR}/themes/eCloud && \ chown -R www-data:www-data ${BASE_DIR}/themes/eCloud/ && \ rm -rf eCloud-theme.tar.gz ${BASE_DIR}/themes/example/ -- GitLab From 65ca0d5365bf097926452139a11551292c1cf6a9 Mon Sep 17 00:00:00 2001 From: Akhil Date: Wed, 9 Nov 2022 14:26:27 +0530 Subject: [PATCH 3/4] Fix theme links --- Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 748d5799..a8911e9e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,6 @@ FROM nextcloud:23.0.9-fpm AS nextcloud ARG BASE_DIR="/usr/src/nextcloud" ARG TMP_PATCH_DIR="/tmp/build_patches" -ARG THEME_VERSION="23.0.1" -ARG SELFHOST_THEME_VERSION="selfhost-22.0.0" ARG THEME_HELPER_VERSION="1.4.4" ARG NEWS_VERSION="18.1.1" ARG QUOTA_WARN_VERSION="1.14.0" @@ -111,6 +109,7 @@ CMD ["php-fpm"] From nextcloud as selfhost ARG BASE_DIR="/usr/src/nextcloud" ARG TMP_PATCH_DIR="/tmp/build_patches" +ARG SELFHOST_THEME_VERSION="selfhost-22.0.0" # Patches COPY patches/ ${TMP_PATCH_DIR}/ @@ -146,6 +145,8 @@ RUN sed -i 's/settings-hint/settings-hint hidden/' ${BASE_DIR}/apps/settings/tem From selfhost as ecloud ARG BASE_DIR="/usr/src/nextcloud" ARG TMP_PATCH_DIR="/tmp/build_patches" +ARG THEME_VERSION="23.0.1" + # Patches COPY patches/ ${TMP_PATCH_DIR}/ RUN patch -u ${BASE_DIR}/core/templates/layout.user.php -i ${TMP_PATCH_DIR}/003-contact-search-removal.patch -- GitLab From 6b24469c6e3c5c1995986898f17390005945ca8a Mon Sep 17 00:00:00 2001 From: Akhil Date: Wed, 9 Nov 2022 14:44:18 +0530 Subject: [PATCH 4/4] Add versions in ecloud build --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index a8911e9e..9c0115e4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,8 +14,6 @@ ARG RAINLOOP_COMMIT_SHA="523518ba" ARG EA_TAG="2.1.1" ARG ECLOUD_LAUNCHER_JOB_ID="389373" ARG GOOGLE_INTEGRATION_VERSION="1.0.8" -ARG LDAP_WRITE_SUPPORT_VERSION="1.4.0" -ARG OIDC_LOGIN_VERSION="2.3.3" RUN sed -i 's/23,0,9,1/23,0,9,19/' ${BASE_DIR}/version.php COPY custom_entrypoint.sh / @@ -146,6 +144,8 @@ From selfhost as ecloud ARG BASE_DIR="/usr/src/nextcloud" ARG TMP_PATCH_DIR="/tmp/build_patches" ARG THEME_VERSION="23.0.1" +ARG LDAP_WRITE_SUPPORT_VERSION="1.4.0" +ARG OIDC_LOGIN_VERSION="2.3.3" # Patches COPY patches/ ${TMP_PATCH_DIR}/ -- GitLab