diff --git a/amps/ags/rm-community/rm-community-repo/Dockerfile b/amps/ags/rm-community/rm-community-repo/Dockerfile index bdb137fdbc..e00c30b734 100644 --- a/amps/ags/rm-community/rm-community-repo/Dockerfile +++ b/amps/ags/rm-community/rm-community-repo/Dockerfile @@ -1,3 +1,4 @@ +ARG BASE_IMAGE # BUILD STAGE AGS FROM debian:11-slim AS AGSBUILDER @@ -12,7 +13,7 @@ RUN unzip -q /build/gs-api-explorer-*.war -d /build/gs-api-explorer && \ chmod -R g-w,o= /build # ACTUAL IMAGE -FROM alfresco/alfresco-community-repo-base:${image.tag} +FROM ${BASE_IMAGE} # Alfresco user does not have permissions to modify webapps or configuration. Switch to root. # The access will be fixed after all operations are done. diff --git a/amps/ags/rm-community/rm-community-repo/pom.xml b/amps/ags/rm-community/rm-community-repo/pom.xml index 8a854b6e13..a00a61d6f8 100644 --- a/amps/ags/rm-community/rm-community-repo/pom.xml +++ b/amps/ags/rm-community/rm-community-repo/pom.xml @@ -15,6 +15,8 @@ ${project.build.directory}/${project.build.finalName}-war alfresco/alfresco-governance-repository-community-base + alfresco/alfresco-community-repo-base + ${project.parent.parent.parent.parent.basedir}/scripts @@ -537,9 +539,43 @@ + + build-docker-images + + + + + io.fabric8 + docker-maven-plugin + + + + ${image.name}:${image.tag} + + + ${base.image}:${image.tag} + + ${project.basedir} + + + + + + + build-image + package + + build + + + + + + + + - build-docker-images - + build-multiarch-docker-images @@ -548,20 +584,51 @@ - ${image.name}:${image.tag} + ${local.registry}/${image.name}:${image.tag} + + + ${builder.name} + + + ${local.registry}/${base.image}:${image.tag} + + - build-image - package + build-push-image + install build + push + + exec-maven-plugin + org.codehaus.mojo + + + prepare-buildx + generate-sources + + exec + + + ${scripts.directory}/prepare_buildx.sh + + ${builder.name} + ${image.registry} + ${image.name} + ${image.tag} + + + + + @@ -578,12 +645,27 @@ - ${image.name}:${image.tag} - ${image.registry} + ${image.registry}/${image.name}:${image.tag} + + + ${builder.name} + + + ${local.registry}/${base.image}:${image.tag} + + ${image.name}:${image.tag} + + + ${builder.name} + + + ${local.registry}/${base.image}:${image.tag} + + @@ -598,6 +680,28 @@ + + exec-maven-plugin + org.codehaus.mojo + + + prepare-buildx + generate-sources + + exec + + + ${scripts.directory}/prepare_buildx.sh + + ${builder.name} + ${image.registry} + ${image.name} + ${image.tag} + + + + + diff --git a/packaging/docker-alfresco/pom.xml b/packaging/docker-alfresco/pom.xml index a65e920840..53a772663b 100644 --- a/packaging/docker-alfresco/pom.xml +++ b/packaging/docker-alfresco/pom.xml @@ -12,6 +12,7 @@ alfresco/alfresco-community-repo-base + ${project.parent.parent.basedir}/scripts @@ -135,7 +136,7 @@ io.fabric8 docker-maven-plugin - + ${image.name}:${image.tag} @@ -156,6 +157,62 @@ + + build-multiarch-docker-images + + + + io.fabric8 + docker-maven-plugin + + + + ${local.registry}/${image.name}:${image.tag} + + + ${builder.name} + + + + + + + + build-push-image + install + + build + push + + + + + + exec-maven-plugin + org.codehaus.mojo + + + prepare-buildx + generate-sources + + exec + + + ${scripts.directory}/prepare_buildx.sh + + ${builder.name} + ${image.registry} + ${image.name} + ${image.tag} + + + + + + + + + push-docker-images @@ -168,8 +225,7 @@ - ${image.name}:${image.tag} - ${image.registry} + ${image.registry}/${image.name}:${image.tag} diff --git a/pom.xml b/pom.xml index 08345fda8a..d933ca448d 100644 --- a/pom.xml +++ b/pom.xml @@ -35,6 +35,8 @@ local latest quay.io + entitled-builder + 127.0.0.1:5000 11 ${java.version} @@ -917,6 +919,21 @@ io.fabric8 docker-maven-plugin 0.42.0 + + + + + + + linux/amd64 + linux/arm64 + + + ${project.basedir} + + + + maven-surefire-plugin diff --git a/scripts/prepare_buildx.sh b/scripts/prepare_buildx.sh new file mode 100755 index 0000000000..377b916371 --- /dev/null +++ b/scripts/prepare_buildx.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +BUILDER_NAME="${1}" +TARGET_REGISTRY="${2}" +TARGET_IMAGE="${3}" +IMAGE_TAG="${4}" + +#Create a `docker-container` builder with host networking and required flags (quay.io) +docker --config target/docker/"${TARGET_REGISTRY}"/"${TARGET_IMAGE}"/"${IMAGE_TAG}"/docker \ +buildx create --use --name "${BUILDER_NAME}" --driver-opt network=host \ +--buildkitd-flags '--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host' + +#Create a `docker-container` builder with host networking and required flags (docker.io) +docker --config target/docker/"${TARGET_IMAGE}"/"${IMAGE_TAG}"/docker \ +buildx create --use --name "${BUILDER_NAME}" --driver-opt network=host \ +--buildkitd-flags '--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host' + +#Create a `docker-container` builder with host networking and required flags (local registry) +docker --config target/docker/127.0.0.1/5000/"${TARGET_IMAGE}"/"${IMAGE_TAG}"/docker \ +buildx create --use --name "${BUILDER_NAME}" --driver-opt network=host \ +--buildkitd-flags '--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host' \ No newline at end of file