mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
ACS-4137 Produce Multi-Arch Docker images (#1797)
* Revert "Revert "ACS-4137 Produce Multi-Arch Docker images (#1656)" (#1796)"
This reverts commit ddbaabb713
.
* ACS-4137 Remove default multi-arch docker-maven-plugin configuration
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
ARG BASE_IMAGE
|
||||||
# BUILD STAGE AGS
|
# BUILD STAGE AGS
|
||||||
FROM debian:11-slim AS AGSBUILDER
|
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
|
chmod -R g-w,o= /build
|
||||||
|
|
||||||
# ACTUAL IMAGE
|
# 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.
|
# Alfresco user does not have permissions to modify webapps or configuration. Switch to root.
|
||||||
# The access will be fixed after all operations are done.
|
# The access will be fixed after all operations are done.
|
||||||
|
@@ -15,6 +15,8 @@
|
|||||||
<app.amp.client.war.folder>${project.build.directory}/${project.build.finalName}-war</app.amp.client.war.folder>
|
<app.amp.client.war.folder>${project.build.directory}/${project.build.finalName}-war</app.amp.client.war.folder>
|
||||||
|
|
||||||
<image.name>alfresco/alfresco-governance-repository-community-base</image.name>
|
<image.name>alfresco/alfresco-governance-repository-community-base</image.name>
|
||||||
|
<base.image>alfresco/alfresco-community-repo-base</base.image>
|
||||||
|
<scripts.directory>${project.parent.parent.parent.parent.basedir}/scripts</scripts.directory>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@@ -537,9 +539,43 @@
|
|||||||
</build>
|
</build>
|
||||||
</profile>
|
</profile>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
<build>
|
||||||
|
<args>
|
||||||
|
<BASE_IMAGE>${base.image}:${image.tag}</BASE_IMAGE>
|
||||||
|
</args>
|
||||||
|
<contextDir>${project.basedir}</contextDir>
|
||||||
|
</build>
|
||||||
|
</image>
|
||||||
|
</images>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>build-image</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>build</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
|
|
||||||
<profile>
|
<profile>
|
||||||
<id>build-docker-images</id>
|
<id>build-multiarch-docker-images</id>
|
||||||
<!-- builds "image:latest" locally -->
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
@@ -548,20 +584,56 @@
|
|||||||
<configuration>
|
<configuration>
|
||||||
<images>
|
<images>
|
||||||
<image>
|
<image>
|
||||||
<name>${image.name}:${image.tag}</name>
|
<name>${local.registry}/${image.name}:${image.tag}</name>
|
||||||
|
<build>
|
||||||
|
<buildx>
|
||||||
|
<platforms>
|
||||||
|
<platform>linux/amd64</platform>
|
||||||
|
<platform>linux/arm64</platform>
|
||||||
|
</platforms>
|
||||||
|
<builderName>${builder.name}</builderName>
|
||||||
|
</buildx>
|
||||||
|
<contextDir>${project.basedir}</contextDir>
|
||||||
|
<args>
|
||||||
|
<BASE_IMAGE>${local.registry}/${base.image}:${image.tag}</BASE_IMAGE>
|
||||||
|
</args>
|
||||||
|
</build>
|
||||||
</image>
|
</image>
|
||||||
</images>
|
</images>
|
||||||
</configuration>
|
</configuration>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>build-image</id>
|
<id>build-push-image</id>
|
||||||
<phase>package</phase>
|
<phase>install</phase>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>build</goal>
|
<goal>build</goal>
|
||||||
|
<goal>push</goal>
|
||||||
</goals>
|
</goals>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>exec-maven-plugin</artifactId>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>prepare-buildx</id>
|
||||||
|
<phase>generate-sources</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>exec</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<executable>${scripts.directory}/prepare_buildx.sh</executable>
|
||||||
|
<arguments>
|
||||||
|
<argument>${builder.name}</argument>
|
||||||
|
<argument>${image.registry}</argument>
|
||||||
|
<argument>${image.name}</argument>
|
||||||
|
<argument>${image.tag}</argument>
|
||||||
|
</arguments>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</profile>
|
</profile>
|
||||||
@@ -578,12 +650,37 @@
|
|||||||
<images>
|
<images>
|
||||||
<image>
|
<image>
|
||||||
<!-- Quay image -->
|
<!-- Quay image -->
|
||||||
<name>${image.name}:${image.tag}</name>
|
<name>${image.registry}/${image.name}:${image.tag}</name>
|
||||||
<registry>${image.registry}</registry>
|
<build>
|
||||||
|
<buildx>
|
||||||
|
<platforms>
|
||||||
|
<platform>linux/amd64</platform>
|
||||||
|
<platform>linux/arm64</platform>
|
||||||
|
</platforms>
|
||||||
|
<builderName>${builder.name}</builderName>
|
||||||
|
</buildx>
|
||||||
|
<args>
|
||||||
|
<BASE_IMAGE>${local.registry}/${base.image}:${image.tag}</BASE_IMAGE>
|
||||||
|
</args>
|
||||||
|
<contextDir>${project.basedir}</contextDir>
|
||||||
|
</build>
|
||||||
</image>
|
</image>
|
||||||
<image>
|
<image>
|
||||||
<!-- DockerHub image -->
|
<!-- DockerHub image -->
|
||||||
<name>${image.name}:${image.tag}</name>
|
<name>${image.name}:${image.tag}</name>
|
||||||
|
<build>
|
||||||
|
<buildx>
|
||||||
|
<platforms>
|
||||||
|
<platform>linux/amd64</platform>
|
||||||
|
<platform>linux/arm64</platform>
|
||||||
|
</platforms>
|
||||||
|
<builderName>${builder.name}</builderName>
|
||||||
|
</buildx>
|
||||||
|
<args>
|
||||||
|
<BASE_IMAGE>${local.registry}/${base.image}:${image.tag}</BASE_IMAGE>
|
||||||
|
</args>
|
||||||
|
<contextDir>${project.basedir}</contextDir>
|
||||||
|
</build>
|
||||||
</image>
|
</image>
|
||||||
</images>
|
</images>
|
||||||
</configuration>
|
</configuration>
|
||||||
@@ -598,6 +695,28 @@
|
|||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>exec-maven-plugin</artifactId>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>prepare-buildx</id>
|
||||||
|
<phase>generate-sources</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>exec</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<executable>${scripts.directory}/prepare_buildx.sh</executable>
|
||||||
|
<arguments>
|
||||||
|
<argument>${builder.name}</argument>
|
||||||
|
<argument>${image.registry}</argument>
|
||||||
|
<argument>${image.name}</argument>
|
||||||
|
<argument>${image.tag}</argument>
|
||||||
|
</arguments>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</profile>
|
</profile>
|
||||||
|
@@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<image.name>alfresco/alfresco-community-repo-base</image.name>
|
<image.name>alfresco/alfresco-community-repo-base</image.name>
|
||||||
|
<scripts.directory>${project.parent.parent.basedir}/scripts</scripts.directory>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
@@ -156,6 +157,67 @@
|
|||||||
</build>
|
</build>
|
||||||
</profile>
|
</profile>
|
||||||
|
|
||||||
|
<profile>
|
||||||
|
<id>build-multiarch-docker-images</id>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>io.fabric8</groupId>
|
||||||
|
<artifactId>docker-maven-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<images>
|
||||||
|
<image>
|
||||||
|
<name>${local.registry}/${image.name}:${image.tag}</name>
|
||||||
|
<build>
|
||||||
|
<buildx>
|
||||||
|
<platforms>
|
||||||
|
<platform>linux/amd64</platform>
|
||||||
|
<platform>linux/arm64</platform>
|
||||||
|
</platforms>
|
||||||
|
<builderName>${builder.name}</builderName>
|
||||||
|
</buildx>
|
||||||
|
<contextDir>${project.basedir}</contextDir>
|
||||||
|
</build>
|
||||||
|
</image>
|
||||||
|
</images>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>build-push-image</id>
|
||||||
|
<phase>install</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>build</goal>
|
||||||
|
<goal>push</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>exec-maven-plugin</artifactId>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>prepare-buildx</id>
|
||||||
|
<phase>generate-sources</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>exec</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<executable>${scripts.directory}/prepare_buildx.sh</executable>
|
||||||
|
<arguments>
|
||||||
|
<argument>${builder.name}</argument>
|
||||||
|
<argument>${image.registry}</argument>
|
||||||
|
<argument>${image.name}</argument>
|
||||||
|
<argument>${image.tag}</argument>
|
||||||
|
</arguments>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
|
|
||||||
<profile>
|
<profile>
|
||||||
<id>push-docker-images</id>
|
<id>push-docker-images</id>
|
||||||
<!-- publishes "image:latest" on Quay & DockerHub -->
|
<!-- publishes "image:latest" on Quay & DockerHub -->
|
||||||
@@ -168,12 +230,29 @@
|
|||||||
<images>
|
<images>
|
||||||
<!-- Quay image -->
|
<!-- Quay image -->
|
||||||
<image>
|
<image>
|
||||||
<name>${image.name}:${image.tag}</name>
|
<name>${image.registry}/${image.name}:${image.tag}</name>
|
||||||
<registry>${image.registry}</registry>
|
<build>
|
||||||
|
<buildx>
|
||||||
|
<platforms>
|
||||||
|
<platform>linux/amd64</platform>
|
||||||
|
<platform>linux/arm64</platform>
|
||||||
|
</platforms>
|
||||||
|
</buildx>
|
||||||
|
<contextDir>${project.basedir}</contextDir>
|
||||||
|
</build>
|
||||||
</image>
|
</image>
|
||||||
<!-- DockerHub image -->
|
<!-- DockerHub image -->
|
||||||
<image>
|
<image>
|
||||||
<name>${image.name}:${image.tag}</name>
|
<name>${image.name}:${image.tag}</name>
|
||||||
|
<build>
|
||||||
|
<buildx>
|
||||||
|
<platforms>
|
||||||
|
<platform>linux/amd64</platform>
|
||||||
|
<platform>linux/arm64</platform>
|
||||||
|
</platforms>
|
||||||
|
</buildx>
|
||||||
|
<contextDir>${project.basedir}</contextDir>
|
||||||
|
</build>
|
||||||
</image>
|
</image>
|
||||||
</images>
|
</images>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
2
pom.xml
2
pom.xml
@@ -35,6 +35,8 @@
|
|||||||
<build-number>local</build-number>
|
<build-number>local</build-number>
|
||||||
<image.tag>latest</image.tag>
|
<image.tag>latest</image.tag>
|
||||||
<image.registry>quay.io</image.registry>
|
<image.registry>quay.io</image.registry>
|
||||||
|
<builder.name>entitled-builder</builder.name>
|
||||||
|
<local.registry>127.0.0.1:5000</local.registry>
|
||||||
|
|
||||||
<java.version>11</java.version>
|
<java.version>11</java.version>
|
||||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||||
|
21
scripts/prepare_buildx.sh
Executable file
21
scripts/prepare_buildx.sh
Executable file
@@ -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'
|
Reference in New Issue
Block a user