diff --git a/images/dotcms-seed/Dockerfile b/images/dotcms-seed/Dockerfile index 2bf962d..38cd75b 100644 --- a/images/dotcms-seed/Dockerfile +++ b/images/dotcms-seed/Dockerfile @@ -7,16 +7,14 @@ LABEL com.dotcms.contact "info@dotcms.com" LABEL com.dotcms.vendor "dotCMS LLC" LABEL com.dotcms.description "dotCMS Content Management System" - WORKDIR /srv # Build env dependencies -RUN apk update && apk --no-cache add bash grep openssl git nodejs=10.14.2-r0 npm=10.14.2-r0 sed - +RUN apk update && apk --no-cache add bash grep openssl git nodejs=10.14.2-r0 npm=10.14.2-r0 sed RUN mkdir -p /build/src \ && echo "Pulling dotCMS src" \ - && cd /build/src && git clone https://github.com/dotCMS/core.git core \ + && cd /build/src && git clone https://github.com/dotCMS/core.git core \ && cd /build/src/core/dotCMS \ && git gc --aggressive \ - && ./gradlew --no-daemon downloadDependencies clonePullTomcatDist -PuseGradleNode=false + && ./gradlew --no-daemon downloadDependencies clonePullTomcatDist -PuseGradleNode=false diff --git a/images/dotcms/Dockerfile b/images/dotcms/Dockerfile index e78fd06..f78fbc6 100644 --- a/images/dotcms/Dockerfile +++ b/images/dotcms/Dockerfile @@ -13,7 +13,7 @@ ARG BUILD_FROM=COMMIT ARG BUILD_ID=HEAD # Tomcat version -ARG TOMCAT_VERSION +ARG TOMCAT_VERSION="" WORKDIR /srv diff --git a/images/dotcms/build-src/build_dotcms.sh b/images/dotcms/build-src/build_dotcms.sh index 3034fb1..772bc7c 100644 --- a/images/dotcms/build-src/build_dotcms.sh +++ b/images/dotcms/build-src/build_dotcms.sh @@ -2,6 +2,8 @@ set -e +echo "Executing: $0 $@" + build_source=$1 build_id=$2 tomcat_version=$3 @@ -25,11 +27,18 @@ build_by_commit() { mkdir -p /build/src && cd /build/src cd /build/src/core + git fetch --all --tags git clean -f -d git pull echo "Checking out commit/tag/branch: $1" - git checkout $1 + if [[ ${is_release} == true ]]; then + echo "Executing: git checkout tags/${1} -b ${1}" + git checkout tags/${1} -b ${1} + else + echo "Executing: git checkout ${1}" + git checkout ${1} + fi cd dotCMS && ./gradlew clonePullTomcatDist createDistPrep -PuseGradleNode=false find ../dist/ -name "*.sh" -exec chmod 500 {} \; @@ -37,9 +46,9 @@ build_by_commit() { } set_tomcat_dir() { - tomcat_versions=$(find /srv/dotserver/ -type d -name tomcat-* | grep -oP "(?<=tomcat-)[0-9]{1}\.[0-9]{1}\.[0-9]+$ | sort -k1.2n") - echo "Found tomcat installations: - ${tomcat_versions}" + tomcat_versions=$(find /srv/dotserver/ -type d -name tomcat-* | grep -oP "(?<=tomcat-)[0-9]{1}\.[0-9]{1}\.[0-9]+$" | sort -n) + display_tomcat_version=$(echo ${tomcat_versions} | tr '\n' ' ') + echo "Found tomcat installations: ${display_tomcat_version}" if [[ -n "${tomcat_version}" ]]; then echo "Provided Tomcat version: ${tomcat_version}" @@ -50,7 +59,7 @@ set_tomcat_dir() { exit 1 fi else - tomcat_version=$(find /srv/dotserver/ -type d -name tomcat-* | grep -oP "(?<=tomcat-)[0-9]{1}\.[0-9]{1}\.[0-9]+$" | sort -k1.2n | tail -n 1) + tomcat_version=$(find /srv/dotserver/ -type d -name tomcat-* | grep -oP "(?<=tomcat-)[0-9]{1}\.[0-9]{1}\.[0-9]+$" | sort -n | tail -n 1) [[ -z "${tomcat_version}" ]] && echo "ERROR: Unable to determine Tomcat version" && exit 1 fi