From: Mathieu Baudier Date: Mon, 6 Jan 2020 13:39:33 +0000 (+0100) Subject: Support multi-architecture containers. X-Git-Tag: argeo-commons-2.1.85~41 X-Git-Url: http://git.argeo.org/?p=lgpl%2Fargeo-commons.git;a=commitdiff_plain;h=36b4b27fd2682280cb9acad1fd14c546387d2d53 Support multi-architecture containers. --- diff --git a/dist/containers/argeo2-all b/dist/containers/argeo2-all new file mode 100755 index 000000000..4ad00fa22 --- /dev/null +++ b/dist/containers/argeo2-all @@ -0,0 +1,6 @@ +#!/bin/sh + +./argeo2-java +./argeo2-tp +./argeo2-node +./argeo2-builder diff --git a/dist/containers/argeo2-builder b/dist/containers/argeo2-builder index 4bb95f029..055522bff 100755 --- a/dist/containers/argeo2-builder +++ b/dist/containers/argeo2-builder @@ -1,12 +1,12 @@ #!/bin/sh source "$(dirname "$0")/buildah-metadata" -container=$(buildah from argeo/argeo2-java:openjdk-v$VERSION_JAVA) +container=$(buildah from argeo/argeo2-java:openjdk-v$VERSION_JAVA-$ARCH) source "$(dirname "$0")/buildah-common" buildah config --label release="1" $container -buildah config --label version="$VERSION" $container +buildah config --label version="$VERSION_MAVEN" $container # Metadata buildah config --label name="argeo2-builder" $container @@ -41,7 +41,7 @@ buildah config --workingdir /root/build/ $container # Perform a build of argeo-commons buildah copy $container ../.. /root/build buildah run $container -- mvn clean install -buildah run $container -- mvn dependency:go-offline +#buildah run $container -- mvn dependency:go-offline # Clean up build directories buildah run $container -- rm -rf /root/.m2/repository/org/argeo/commons @@ -51,7 +51,8 @@ buildah run $container -- mkdir -p /root/build/ # Configuration buildah config --entrypoint '["mvn","clean","install"]' $container -buildah commit --rm --format docker $container argeo/argeo2-builder:maven-v$VERSION_MAVEN -buildah tag argeo/argeo2-builder:maven-v$VERSION_MAVEN argeo/argeo2-builder:latest -buildah push argeo/argeo2-builder:maven-v$VERSION_MAVEN docker://argeo/argeo2-builder:maven-v$VERSION_MAVEN -buildah push argeo/argeo2-builder:maven-v$VERSION_MAVEN docker://argeo/argeo2-builder:latest +buildah commit --rm --format docker $container argeo/argeo2-builder:maven-v$VERSION_MAVEN-$ARCH +buildah tag argeo/argeo2-builder:maven-v$VERSION_MAVEN-$ARCH argeo/argeo2-builder:$ARCH + +buildah push argeo/argeo2-builder:maven-v$VERSION_MAVEN-$ARCH docker://argeo/argeo2-builder:maven-v$VERSION_MAVEN-$ARCH +buildah push argeo/argeo2-builder:$ARCH docker://argeo/argeo2-builder:$ARCH diff --git a/dist/containers/argeo2-java b/dist/containers/argeo2-java index af25a56b6..170872f36 100755 --- a/dist/containers/argeo2-java +++ b/dist/containers/argeo2-java @@ -1,6 +1,7 @@ #!/bin/sh source "$(dirname "$0")/buildah-metadata" +buildah pull ubi8/ubi-minimal container=$(buildah from ubi8/ubi-minimal) source "$(dirname "$0")/buildah-common" @@ -21,6 +22,7 @@ buildah run $container -- microdnf clean all buildah config --entrypoint '["java"]' $container buildah commit --rm --format docker $container argeo/argeo2-java:openjdk-v$VERSION_JAVA-$ARCH -buildah tag argeo/argeo2-java:openjdk-v$VERSION_JAVA argeo/argeo2-java:$ARCH -buildah push argeo/argeo2-java:openjdk-v$VERSION_JAVA docker://argeo/argeo2-java:openjdk-v$VERSION_JAVA-$ARCH -buildah push argeo/argeo2-java:openjdk-v$VERSION_JAVA docker://argeo/argeo2-java:$ARCH +buildah tag argeo/argeo2-java:openjdk-v$VERSION_JAVA-$ARCH argeo/argeo2-java:$ARCH + +buildah push argeo/argeo2-java:openjdk-v$VERSION_JAVA-$ARCH docker://argeo/argeo2-java:openjdk-v$VERSION_JAVA-$ARCH +buildah push argeo/argeo2-java:$ARCH docker://argeo/argeo2-java:$ARCH diff --git a/dist/containers/argeo2-lists b/dist/containers/argeo2-lists new file mode 100755 index 000000000..361fb3f77 --- /dev/null +++ b/dist/containers/argeo2-lists @@ -0,0 +1,15 @@ +#!/bin/sh + +# Multi-architecture manifests +buildah manifest create argeo/argeo2-java:latest docker://argeo/argeo2-java:x86_64 docker://argeo/argeo2-java:aarch64 +buildah manifest push argeo/argeo2-java:latest docker://argeo/argeo2-java:latest + +buildah manifest create argeo/argeo2-tp:latest docker://argeo/argeo2-tp:x86_64 docker://argeo/argeo2-tp:aarch64 +buildah manifest push argeo/argeo2-tp:latest docker://argeo/argeo2-tp:latest + +buildah manifest create argeo/argeo2-node:latest docker://argeo/argeo2-node:x86_64 docker://argeo/argeo2-node:aarch64 +buildah manifest push argeo/argeo2-node:latest docker://argeo/argeo2-node:latest + +buildah manifest create argeo/argeo2-builder:latest docker://argeo/argeo2-builder:x86_64 docker://argeo/argeo2-builder:aarch64 +buildah manifest push argeo/argeo2-builder:latest docker://argeo/argeo2-builder:latest + diff --git a/dist/containers/argeo2-node b/dist/containers/argeo2-node index 839d3cdb5..8578ab94a 100755 --- a/dist/containers/argeo2-node +++ b/dist/containers/argeo2-node @@ -1,17 +1,16 @@ #!/bin/sh source "$(dirname "$0")/buildah-metadata" -container=$(buildah from argeo/argeo2-tp:$VERSION_ARGEO_TP) +container=$(buildah from argeo/argeo2-tp:$VERSION_ARGEO_TP-$ARCH) # Override version -VERSION=2.1.84 #buildah copy $container argeo2-rpmfactory.repo /etc/yum.repos.d/ #buildah copy $container /srv/rpmfactory/argeo-osgi-2/el7/ /srv/rpmfactory/argeo-osgi-2/el7/ source "$(dirname "$0")/buildah-common" buildah config --label release="1" $container -buildah config --label version="$VERSION" $container +buildah config --label version="$VERSION_ARGEO_COMMONS" $container # Metadata buildah config --label name="argeo2-node" $container @@ -28,7 +27,8 @@ buildah run $container -- microdnf clean all buildah config --entrypoint '["/usr/sbin/argeoctl","start"]' $container buildah config --port 8080 $container -buildah commit --rm --format docker $container argeo/argeo2-node:$VERSION -buildah tag argeo/argeo2-node:$VERSION argeo/argeo2-node:latest -buildah push argeo/argeo2-node:$VERSION docker://argeo/argeo2-node:$VERSION -buildah push argeo/argeo2-node:$VERSION docker://argeo/argeo2-node:latest +buildah commit --rm --format docker $container argeo/argeo2-node:$VERSION_ARGEO_COMMONS-$ARCH +buildah tag argeo/argeo2-node:$VERSION_ARGEO_COMMONS-$ARCH argeo/argeo2-node:$ARCH + +buildah push argeo/argeo2-node:$VERSION_ARGEO_COMMONS-$ARCH docker://argeo/argeo2-node:$VERSION_ARGEO_COMMONS-$ARCH +buildah push argeo/argeo2-node:$ARCH docker://argeo/argeo2-node:$ARCH diff --git a/dist/containers/argeo2-tp b/dist/containers/argeo2-tp index ecf60a059..a033ab00e 100755 --- a/dist/containers/argeo2-tp +++ b/dist/containers/argeo2-tp @@ -1,7 +1,7 @@ #!/bin/sh source "$(dirname "$0")/buildah-metadata" -container=$(buildah from argeo/argeo2-java:openjdk-v$VERSION_JAVA) +container=$(buildah from argeo/argeo2-java:$ARCH) source "$(dirname "$0")/buildah-common" @@ -24,7 +24,8 @@ buildah config --entrypoint '["java","-Dosgi.bundles=org.argeo.osgi.boot.jar@sta buildah config --workingdir /var/lib/argeo $container buildah config --volume /var/lib/argeo $container -buildah commit --rm --format docker $container argeo/argeo2-tp:$VERSION_ARGEO_TP -buildah tag argeo/argeo2-tp:$VERSION_ARGEO_TP argeo/argeo2-tp:latest -buildah push argeo/argeo2-tp:$VERSION_ARGEO_TP docker://argeo/argeo2-tp:$VERSION_ARGEO_TP -buildah push argeo/argeo2-tp:$VERSION_ARGEO_TP docker://argeo/argeo2-tp:latest +buildah commit --rm --format docker $container argeo/argeo2-tp:$VERSION_ARGEO_TP-$ARCH +buildah tag argeo/argeo2-tp:$VERSION_ARGEO_TP-$ARCH argeo/argeo2-tp:$ARCH + +buildah push argeo/argeo2-tp:$VERSION_ARGEO_TP-$ARCH docker://argeo/argeo2-tp:$VERSION_ARGEO_TP-$ARCH +buildah push argeo/argeo2-tp:$ARCH docker://argeo/argeo2-tp:$ARCH diff --git a/dist/containers/buildah-common b/dist/containers/buildah-common index ca344a35b..6e9002815 100755 --- a/dist/containers/buildah-common +++ b/dist/containers/buildah-common @@ -1,10 +1,8 @@ #!/bin/sh -## Log-in to Red Hat registry first +## Log-in to registries first # podman login registry.redhat.io - -ARCH=`arch` -echo Building for architecture $ARCH +# podman login docker.io # Metadata buildah config --label maintainer="Mathieu Baudier, mbaudier at argeo.org" $container @@ -25,6 +23,3 @@ buildah config --label vcs-ref= $container buildah config --label vcs-type= $container buildah config --label summary= $container -# To create a multi-arch manifest -#buildah manifest create argeo/argeo2-java:latest docker://argeo/argeo2-java:x86_64 docker://argeo/argeo2-java:aarch64 -#buildah manifest push argeo/argeo2-java:latest docker://argeo/argeo2-java:latest diff --git a/dist/containers/filtered/buildah-metadata b/dist/containers/filtered/buildah-metadata index fd437d928..5c22840e0 100644 --- a/dist/containers/filtered/buildah-metadata +++ b/dist/containers/filtered/buildah-metadata @@ -1,5 +1,8 @@ -VERSION=${project.version} +VERSION_ARGEO_COMMONS=2.1.84 VERSION_ARGEO_TP=${version.argeo-tp} VERSION_MAVEN=3.5.4 VERSION_JAVA=11.0.5 + +ARCH=`arch` +echo Building for architecture $ARCH