diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1e9fa46e1c5b90c63952b006eaff99584e4338a6..3e0a8000998bd682df0a2cb9d0b22fa0f3482d22 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -10,23 +10,56 @@ 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-branch: - except: - - tags stage: build + variables: + TARGET: ecloud + rules: + - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' + when: never + - if: $CI_COMMIT_TAG != null + when: never + - if: $CI_COMMIT_REF_SLUG =~ /^selfhost/ + variables: + TARGET: "selfhost" + - if: $CI_COMMIT_REF_SLUG != null + when: on_success + allow_failure: true script: - - docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" . + - 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:$CI_COMMIT_REF_SLUG" . - docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" build-tag: - only: - - tags stage: build + variables: + TARGET: ecloud + allow_failure: true + rules: + - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' + when: never + - if: $CI_COMMIT_TAG == null + when: never + - if: $CI_COMMIT_REF_SLUG =~ /^selfhost/ + variables: + TARGET: "selfhost" + - if: $CI_COMMIT_TAG != null + when: on_success script: - - docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG" . - - docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG" + - 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:$CI_COMMIT_REF_SLUG" . + - docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" + +docker-tag: + stage: .post + rules: + - when: manual + script: + - echo "SOURCE $SOURCE, TARGET $TARGET" + - docker pull $CI_REGISTRY_IMAGE:$SOURCE + - docker tag $CI_REGISTRY_IMAGE:$SOURCE $CI_REGISTRY_IMAGE:$TARGET + - docker push $CI_REGISTRY_IMAGE:$TARGET \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 1a9b332b948e72c8428fb2b4f6bd2bceea763341..81ffd5c69c5b32b84d130889fc4a170b47e5a8f6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,5 @@ -FROM nextcloud:20.0.12-fpm +FROM nextcloud:20.0.12-fpm as base ARG BASE_DIR="/usr/src/nextcloud" -ARG TMP_PATCH_DIR="/tmp/build_patches" ARG THEME_VERSION="20.1.3" ARG THEME_HELPER_VERSION="1.0.1" ARG NEWS_VERSION="16.0.1" @@ -17,10 +16,9 @@ ARG ECLOUD_LAUNCHER_JOB_ID="204816" ARG GOOGLE_INTEGRATION_VERSION="1.0.5-1-nightly" RUN mkdir -p /var/www/skeleton/Documents && mkdir -p /var/www/skeleton/Images -COPY patches/ ${TMP_PATCH_DIR}/ COPY custom_entrypoint.sh / RUN chmod +x /custom_entrypoint.sh -RUN sed -i 's/20,0,12,1/20,0,12,16/' ${BASE_DIR}/version.php +RUN sed -i 's/20,0,12,1/20,0,12,17/' ${BASE_DIR}/version.php # Install unzip for unzipping artifacts RUN apt-get update && apt-get install unzip @@ -101,31 +99,6 @@ RUN sed -i "s/\$systemConfig->setValue('theme', '');/\$systemConfig->setValue('t # fix min version of google data migration app RUN sed -i "s/min-version=\"22\"/min-version=\"20\"/" ${BASE_DIR}/custom_apps/integration_google/appinfo/info.xml -# Patches -RUN patch -u ${BASE_DIR}/core/Controller/LoginController.php -i ${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 -RUN patch -u ${BASE_DIR}/core/Controller/SvgController.php -i ${TMP_PATCH_DIR}/008-svg-controller-theme-svgs.patch -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 rm -rf ${TMP_PATCH_DIR} - -# autocomplete leak tweak apps frontend with sed, disable group suggestion - -RUN cd ${BASE_DIR}/custom_apps/contacts && sed -i 's/"GROUP","INDIVIDUAL"/"INDIVIDUAL"/g' js/contacts-main.js -RUN cd ${BASE_DIR}/custom_apps/calendar && sed -i 's/"GROUP","INDIVIDUAL"/"INDIVIDUAL"/g' js/calendar.js -RUN cd ${BASE_DIR}/custom_apps/calendar && sed -i 's/anyof/allof/g' js/calendar.js - -# Set default widgets to calendar, tasks and notes -RUN sed -i 's/recommendations,spreed,mail,calendar/calendar,tasks,notes/' ${BASE_DIR}/apps/dashboard/lib/Controller/DashboardController.php - # Remove colored background from email template logo RUN sed -i 's/$this->header, \[$this->themingDefaults->getColorPrimary()/$this->header, \["none"/' ${BASE_DIR}/lib/private/Mail/EMailTemplate.php @@ -147,3 +120,44 @@ RUN sed -i 's/https:\/\/nextcloud.com\/signup\//https:\/\/e\.foundation\/