From 4baa5a8275459352edcc98dcf324dbc322443ada Mon Sep 17 00:00:00 2001 From: Eliza Stan <54021458+elizastan@users.noreply.github.com> Date: Wed, 25 Aug 2021 10:23:18 +0300 Subject: [PATCH] APPS-1068 Publish AGS-specific docker images from acs-packaging (#1431) Co-authored-by: cezar.leahu --- docker-alfresco/ags/Dockerfile | 29 ++++++ docker-alfresco/ags/pom.xml | 72 +++++++++++++++ docker-alfresco/pom.xml | 1 + docker-share/ags/Dockerfile | 14 +++ docker-share/ags/pom.xml | 158 +++++++++++++++++++++++++++++++++ docker-share/pom.xml | 12 +++ pom.xml | 12 ++- scripts/travis/build.sh | 26 +++++- 8 files changed, 319 insertions(+), 5 deletions(-) create mode 100644 docker-alfresco/ags/Dockerfile create mode 100644 docker-alfresco/ags/pom.xml create mode 100644 docker-share/ags/Dockerfile create mode 100644 docker-share/ags/pom.xml create mode 100644 docker-share/pom.xml diff --git a/docker-alfresco/ags/Dockerfile b/docker-alfresco/ags/Dockerfile new file mode 100644 index 000000000..cf739c604 --- /dev/null +++ b/docker-alfresco/ags/Dockerfile @@ -0,0 +1,29 @@ +### Apply AGS community repo AMP to ACS image +FROM alfresco/alfresco-content-repository-community:${image.tag} + +# Alfresco user does not have permissions to modify webapps or configuration. Switch to root. +# The access will be fixed after all operations are done. +USER root + +COPY target/alfresco-governance-services-community-repo-*.amp /usr/local/tomcat/amps/ + +# Install amps on alfresco.war +RUN java -jar /usr/local/tomcat/alfresco-mmt/alfresco-mmt*.jar install \ + /usr/local/tomcat/amps \ + /usr/local/tomcat/webapps/alfresco -directory -nobackup + +### Copy gs-api-explorer war into webapps folder +COPY target/gs-api-explorer-*.war /usr/local/tomcat/webapps/ + +### Unpack gs-api-explorer.war +RUN mkdir /usr/local/tomcat/webapps/gs-api-explorer && cd /usr/local/tomcat/webapps/gs-api-explorer && \ + jar -xvf /usr/local/tomcat/webapps/gs-api-explorer-*.war && rm -f /usr/local/tomcat/webapps/gs-api-explorer-*.war + +# All files in the tomcat folder must be owned by root user and Alfresco group as mentioned in the parent Dockerfile +RUN chgrp -R Alfresco /usr/local/tomcat && \ + find /usr/local/tomcat/webapps -type d -exec chmod 0750 {} \; && \ + find /usr/local/tomcat/webapps -type f -exec chmod 0640 {} \; && \ + chmod -R g+r /usr/local/tomcat/webapps + +# Switching back to alfresco user after having added amps files to run the container as non-root +USER alfresco \ No newline at end of file diff --git a/docker-alfresco/ags/pom.xml b/docker-alfresco/ags/pom.xml new file mode 100644 index 000000000..aa61f2778 --- /dev/null +++ b/docker-alfresco/ags/pom.xml @@ -0,0 +1,72 @@ + + 4.0.0 + content-services-community-docker-ags + Alfresco Content Services Community Docker Image Builder for AGS + Alfresco Governance Services Community Repository Extension + pom + + + org.alfresco + content-services-community-docker + 7.1.0-SNAPSHOT + + + + alfresco/alfresco-governance-repository-community + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + unpack-war-files + process-resources + + unpack + + + + + org.alfresco + api-explorer + ${alfresco.api-explorer.version} + war + ${project.build.directory}/war/api-explorer + + + + + + copy-amps + process-resources + + copy + + + + + org.alfresco + alfresco-governance-services-community-rest-api-explorer + ${dependency.alfresco-community-repo.version} + war + gs-api-explorer-${dependency.alfresco-community-repo.version}.war + ${project.build.directory} + + + org.alfresco + alfresco-governance-services-community-repo + ${dependency.alfresco-community-repo.version} + amp + ${project.build.directory} + + + + + + + + + \ No newline at end of file diff --git a/docker-alfresco/pom.xml b/docker-alfresco/pom.xml index 0b6fe6f80..3568a200c 100644 --- a/docker-alfresco/pom.xml +++ b/docker-alfresco/pom.xml @@ -12,6 +12,7 @@ alfresco/alfresco-content-repository-community + NEVER diff --git a/docker-share/ags/Dockerfile b/docker-share/ags/Dockerfile new file mode 100644 index 000000000..3bf9b5df8 --- /dev/null +++ b/docker-share/ags/Dockerfile @@ -0,0 +1,14 @@ +### Apply AGS community share AMP to Share image +FROM alfresco/alfresco-share-base:${share.image.tag} + +LABEL quay.expires-after=${docker.quay-expires.value} + +### Copy the AMP from build context to amps_share +COPY target/alfresco-governance-services-community-share-*.amp /usr/local/tomcat/amps_share/ +### Install AMP on share +RUN java -jar /usr/local/tomcat/alfresco-mmt/alfresco-mmt*.jar install \ + /usr/local/tomcat/amps_share/alfresco-governance-services-community-share-*.amp /usr/local/tomcat/webapps/share -nobackup + +ENTRYPOINT ["/usr/local/tomcat/shared/classes/alfresco/substituter.sh", "catalina.sh run"] + +EXPOSE 8000 diff --git a/docker-share/ags/pom.xml b/docker-share/ags/pom.xml new file mode 100644 index 000000000..afd29c17d --- /dev/null +++ b/docker-share/ags/pom.xml @@ -0,0 +1,158 @@ + + 4.0.0 + share-community-docker-ags + pom + Alfresco Share Community Docker Image Builder for AGS + Alfresco Governance Services Share Community Extension + + + org.alfresco + share-community-docker + 7.1.0-SNAPSHOT + + + + alfresco/alfresco-governance-share-community + NEVER + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy-amps + process-resources + + copy + + + + + org.alfresco + alfresco-governance-services-community-share + ${dependency.alfresco-community-share.version} + amp + + + ${project.build.directory} + + + + + + + + + + build-docker-images + + + + + io.fabric8 + docker-maven-plugin + + + + ${image.name}:${image.tag} + + + + + + build-image + install + + build + + + + + + + + + + push-docker-images + + + + + io.fabric8 + docker-maven-plugin + + + + + ${image.name}:${image.tag} + ${image.registry} + + + + + + build-push-image + install + + build + push + + + + + + + + + + release + + + + + io.fabric8 + docker-maven-plugin + + + build-push-image + deploy + + + + + ${image.name}:${project.version} + + + + + build + push + + + + build-push-quay-image + deploy + + + + + ${image.name}:${project.version} + ${image.registry} + + + + + build + push + + + + + + + + + \ No newline at end of file diff --git a/docker-share/pom.xml b/docker-share/pom.xml new file mode 100644 index 000000000..ba844d66f --- /dev/null +++ b/docker-share/pom.xml @@ -0,0 +1,12 @@ + + 4.0.0 + share-community-docker + Alfresco Share Community Docker Image Builder + pom + + + org.alfresco + acs-community-packaging + 7.1.0-SNAPSHOT + + diff --git a/pom.xml b/pom.xml index 905fadb36..bf197f377 100644 --- a/pom.xml +++ b/pom.xml @@ -9,15 +9,16 @@ org.alfresco alfresco-community-repo ../alfresco-community-repo/pom.xml - 11.86 + 11.117 - 11.86 - 11.46 - 7.1.0-M2 + 11.117 + 11.62 + 7.1.0-A9 ${dependency.alfresco-community-repo.version} + ${dependency.alfresco-community-share.version} @@ -42,6 +43,7 @@ distribution public-javadoc docker-alfresco + docker-share @@ -49,6 +51,8 @@ ags distribution-ags + docker-alfresco/ags + docker-share/ags diff --git a/scripts/travis/build.sh b/scripts/travis/build.sh index 5ebf2f7a1..d30c8a787 100644 --- a/scripts/travis/build.sh +++ b/scripts/travis/build.sh @@ -37,8 +37,32 @@ else pullUpstreamTagAndBuildDockerImage "${UPSTREAM_REPO}" "${COM_DEPENDENCY_VERSION}" "-Pbuild-docker-images -Pags" fi +SHARE_DEPENDENCY_VERSION="$(retrievePomProperty "dependency.alfresco-community-share.version")" +SHARE_IMAGE=$([[ "${SHARE_DEPENDENCY_VERSION}" =~ ^.+-SNAPSHOT$ ]] && echo "-Dshare.image.tag=latest" || echo) + +# Prevent merging of any SNAPSHOT dependencies into the master or the release/* branches +if [[ $(isPullRequestBuild) && "${SHARE_DEPENDENCY_VERSION}" =~ ^.+-SNAPSHOT$ && "${TRAVIS_BRANCH}" =~ ^master$|^release/.+$ ]] ; then + printf "PRs with SNAPSHOT dependencies are not allowed into master or release branches\n" + exit 1 +fi + +# Prevent release jobs from starting when there are SNAPSHOT upstream dependencies +if [[ "${SHARE_DEPENDENCY_VERSION}" =~ ^.+-SNAPSHOT$ ]] && [ "${TRAVIS_BUILD_STAGE_NAME,,}" = "release" ] ; then + printf "Cannot release project with SNAPSHOT dependencies!\n" + exit 1 +fi + +SHARE_UPSTREAM_REPO="github.com/Alfresco/alfresco-community-share.git" + +# Checkout the upstream share project (tag or branch; + build if the latter) +if [[ "${SHARE_DEPENDENCY_VERSION}" =~ ^.+-SNAPSHOT$ ]] ; then + pullAndBuildSameBranchOnUpstream "${SHARE_UPSTREAM_REPO}" "-Pbuild-docker-images -Pags -Ddocker.quay-expires.value=NEVER ${REPO_IMAGE} -Ddependency.alfresco-community-repo.version=${COM_DEPENDENCY_VERSION}" +else + pullUpstreamTagAndBuildDockerImage "${SHARE_UPSTREAM_REPO}" "${SHARE_DEPENDENCY_VERSION}" "-Pbuild-docker-images -Pags -Ddocker.quay-expires.value=NEVER -Ddependency.alfresco-community-repo.version=${COM_DEPENDENCY_VERSION}" +fi + # Build the current project -mvn -B -V -q install -DskipTests -Dmaven.javadoc.skip=true -Pbuild-docker-images -Pags ${REPO_IMAGE} +mvn -B -V -q install -DskipTests -Dmaven.javadoc.skip=true -Pbuild-docker-images -Pags ${REPO_IMAGE} ${SHARE_IMAGE} popd