APPS-1068 Publish AGS-specific docker images from acs-packaging (#1431)

Co-authored-by: cezar.leahu <cezar.leahu@ness.com>
This commit is contained in:
Eliza Stan
2021-08-25 10:23:18 +03:00
committed by GitHub
parent ecdd3ff346
commit 4baa5a8275
8 changed files with 319 additions and 5 deletions

View File

@@ -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

View File

@@ -0,0 +1,72 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>content-services-community-docker-ags</artifactId>
<name>Alfresco Content Services Community Docker Image Builder for AGS</name>
<description>Alfresco Governance Services Community Repository Extension</description>
<packaging>pom</packaging>
<parent>
<groupId>org.alfresco</groupId>
<artifactId>content-services-community-docker</artifactId>
<version>7.1.0-SNAPSHOT</version>
</parent>
<properties>
<image.name>alfresco/alfresco-governance-repository-community</image.name>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-war-files</id>
<phase>process-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.alfresco</groupId>
<artifactId>api-explorer</artifactId>
<version>${alfresco.api-explorer.version}</version>
<type>war</type>
<outputDirectory>${project.build.directory}/war/api-explorer</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
<execution>
<id>copy-amps</id>
<phase>process-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-governance-services-community-rest-api-explorer</artifactId>
<version>${dependency.alfresco-community-repo.version}</version>
<type>war</type>
<destFileName>gs-api-explorer-${dependency.alfresco-community-repo.version}.war</destFileName>
<outputDirectory>${project.build.directory}</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-governance-services-community-repo</artifactId>
<version>${dependency.alfresco-community-repo.version}</version>
<type>amp</type>
<outputDirectory>${project.build.directory}</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -12,6 +12,7 @@
<properties> <properties>
<image.name>alfresco/alfresco-content-repository-community</image.name> <image.name>alfresco/alfresco-content-repository-community</image.name>
<docker.quay-expires.value>NEVER</docker.quay-expires.value>
</properties> </properties>
<build> <build>

View File

@@ -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

158
docker-share/ags/pom.xml Normal file
View File

@@ -0,0 +1,158 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>share-community-docker-ags</artifactId>
<packaging>pom</packaging>
<name>Alfresco Share Community Docker Image Builder for AGS</name>
<description>Alfresco Governance Services Share Community Extension</description>
<parent>
<groupId>org.alfresco</groupId>
<artifactId>share-community-docker</artifactId>
<version>7.1.0-SNAPSHOT</version>
</parent>
<properties>
<image.name>alfresco/alfresco-governance-share-community</image.name>
<docker.quay-expires.value>NEVER</docker.quay-expires.value>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-amps</id>
<phase>process-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-governance-services-community-share</artifactId>
<version>${dependency.alfresco-community-share.version}</version>
<type>amp</type>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>build-docker-images</id>
<!-- builds "image:latest" locally -->
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<images>
<image>
<name>${image.name}:${image.tag}</name>
</image>
</images>
</configuration>
<executions>
<execution>
<id>build-image</id>
<phase>install</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>push-docker-images</id>
<!-- publishes "image:latest" to Quay -->
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<images>
<!-- Quay image -->
<image>
<name>${image.name}:${image.tag}</name>
<registry>${image.registry}</registry>
</image>
</images>
</configuration>
<executions>
<execution>
<id>build-push-image</id>
<phase>install</phase>
<goals>
<goal>build</goal>
<goal>push</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>release</id>
<!-- publishes "image:release_version" to DockerHub and Quay -->
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<executions>
<execution>
<id>build-push-image</id>
<phase>deploy</phase>
<configuration combine.self="override">
<images>
<!-- DockerHub image -->
<image>
<name>${image.name}:${project.version}</name>
</image>
</images>
</configuration>
<goals>
<goal>build</goal>
<goal>push</goal>
</goals>
</execution>
<execution>
<id>build-push-quay-image</id>
<phase>deploy</phase>
<configuration combine.self="override">
<images>
<!-- Quay image -->
<image>
<name>${image.name}:${project.version}</name>
<registry>${image.registry}</registry>
</image>
</images>
</configuration>
<goals>
<goal>build</goal>
<goal>push</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

12
docker-share/pom.xml Normal file
View File

@@ -0,0 +1,12 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>share-community-docker</artifactId>
<name>Alfresco Share Community Docker Image Builder</name>
<packaging>pom</packaging>
<parent>
<groupId>org.alfresco</groupId>
<artifactId>acs-community-packaging</artifactId>
<version>7.1.0-SNAPSHOT</version>
</parent>
</project>

12
pom.xml
View File

@@ -9,15 +9,16 @@
<groupId>org.alfresco</groupId> <groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo</artifactId> <artifactId>alfresco-community-repo</artifactId>
<relativePath>../alfresco-community-repo/pom.xml</relativePath> <relativePath>../alfresco-community-repo/pom.xml</relativePath>
<version>11.86</version> <version>11.117</version>
</parent> </parent>
<properties> <properties>
<dependency.alfresco-community-repo.version>11.86</dependency.alfresco-community-repo.version> <dependency.alfresco-community-repo.version>11.117</dependency.alfresco-community-repo.version>
<dependency.alfresco-community-share.version>11.46</dependency.alfresco-community-share.version> <dependency.alfresco-community-share.version>11.62</dependency.alfresco-community-share.version>
<alfresco.share.version>7.1.0-M2</alfresco.share.version> <!-- Share distribution zip from acs-packaging --> <alfresco.share.version>7.1.0-A9</alfresco.share.version> <!-- Share distribution zip from acs-packaging -->
<repo.image.tag>${dependency.alfresco-community-repo.version}</repo.image.tag> <repo.image.tag>${dependency.alfresco-community-repo.version}</repo.image.tag>
<share.image.tag>${dependency.alfresco-community-share.version}</share.image.tag>
</properties> </properties>
<scm> <scm>
@@ -42,6 +43,7 @@
<module>distribution</module> <module>distribution</module>
<module>public-javadoc</module> <module>public-javadoc</module>
<module>docker-alfresco</module> <module>docker-alfresco</module>
<module>docker-share</module>
</modules> </modules>
<profiles> <profiles>
@@ -49,6 +51,8 @@
<id>ags</id> <id>ags</id>
<modules> <modules>
<module>distribution-ags</module> <module>distribution-ags</module>
<module>docker-alfresco/ags</module>
<module>docker-share/ags</module>
</modules> </modules>
</profile> </profile>
<profile> <profile>

View File

@@ -37,8 +37,32 @@ else
pullUpstreamTagAndBuildDockerImage "${UPSTREAM_REPO}" "${COM_DEPENDENCY_VERSION}" "-Pbuild-docker-images -Pags" pullUpstreamTagAndBuildDockerImage "${UPSTREAM_REPO}" "${COM_DEPENDENCY_VERSION}" "-Pbuild-docker-images -Pags"
fi 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 # 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 popd