From 2e69fbd91b564d534f7bb5baa30774cdc35427ff Mon Sep 17 00:00:00 2001 From: Mathieu Baudier Date: Tue, 17 Dec 2019 13:36:06 +0100 Subject: [PATCH] Improve containers. --- dist/containers/.gitignore | 1 + dist/containers/argeo2-builder | 45 +++++++++++++++++++++++ dist/containers/argeo2-builder-openjdk | 37 ------------------- dist/containers/argeo2-node | 6 +-- dist/containers/argeo2-tp | 6 +-- dist/containers/buildah-common | 2 + dist/containers/filtered/buildah-metadata | 2 + dist/containers/maven.conf | 1 + dist/containers/pom.xml | 39 ++++++++++++++++++++ dist/pom.xml | 1 + 10 files changed, 97 insertions(+), 43 deletions(-) create mode 100644 dist/containers/.gitignore create mode 100755 dist/containers/argeo2-builder delete mode 100755 dist/containers/argeo2-builder-openjdk create mode 100644 dist/containers/filtered/buildah-metadata create mode 100644 dist/containers/maven.conf create mode 100644 dist/containers/pom.xml diff --git a/dist/containers/.gitignore b/dist/containers/.gitignore new file mode 100644 index 000000000..5a220071f --- /dev/null +++ b/dist/containers/.gitignore @@ -0,0 +1 @@ +/buildah-metadata diff --git a/dist/containers/argeo2-builder b/dist/containers/argeo2-builder new file mode 100755 index 000000000..e0f8f1be9 --- /dev/null +++ b/dist/containers/argeo2-builder @@ -0,0 +1,45 @@ +#!/bin/sh + +container=$(buildah from ubi8/ubi-minimal) + + +source "$(dirname "$0")/buildah-common" + +buildah config --label release="1" $container +buildah config --label version="$VERSION" $container + +# Metadata +buildah config --label name="argeo2-builder-openjdk11-ubi8" $container +buildah config --label summary="Argeo 2 Builder based on OpenJDK 11 and Red Hat UBI 8" $container + +# Utilities +#buildah run $container -- microdnf -y install git + +# Java 11 +buildah run $container -- microdnf -y install java-11-openjdk-devel +# Maven +buildah run $container -- microdnf -y install maven +buildah copy $container maven.conf /etc/java/maven.conf + +buildah run $container -- mkdir -p /srv/javafactory/ + +# Working dir +buildah run $container -- mkdir -p /root/checkout/ +buildah config --workingdir /root/checkout/ $container + +# Perform a build of argeo-commons +#buildah run $container -- /usr/bin/git clone http://git.argeo.org/apache2/argeo-commons.git . +buildah copy $container ../.. /root/checkout +buildah run $container -- /usr/bin/mvn clean install +buildah run $container -- /usr/bin/mvn dependency:go-offline +# Clean up build directories +buildah run $container -- /usr/bin/rm -rf /root/.m2/repository/org/argeo/commons +buildah run $container -- /usr/bin/rm -rf /root/checkout +buildah run $container -- mkdir -p /root/checkout/ + +# Configuration +#buildah config --workingdir /root/checkout/ $container +#buildah config --entrypoint '["/usr/bin/mvn","clean","deploy"]' $container +buildah config --cmd '/usr/bin/mvn clean deploy' $container + +buildah commit $container argeo2-builder:latest diff --git a/dist/containers/argeo2-builder-openjdk b/dist/containers/argeo2-builder-openjdk deleted file mode 100755 index 5f573a37d..000000000 --- a/dist/containers/argeo2-builder-openjdk +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh - -container=$(buildah from centos:centos8) - -buildah config --label release="1" $container -# Use argeo-osgi-plugin version for the time being -buildah config --label version="2.1.1" $container - -source "$(dirname "$0")/buildah-common" - -# Metadata -buildah config --label name="argeo2-builder-openjdk11-ubi8" $container -buildah config --label summary="Argeo 2 Builder based on OpenJDK 11 and Red Hat UBI 8" $container - -# Utilities -buildah run $container -- dnf -y install rpm-build -buildah run $container -- dnf -y install git - -# Java 11 -buildah run $container -- dnf -y install java-11-openjdk-devel -# Maven -buildah run $container -- dnf -y install maven - -# Perform a build of argeo-commons -buildah run $container -- mkdir -p /root/dev/git/apache2/ -buildah run $container -- mkdir -p /srv/rpmfactory/ -buildah run $container -- mkdir -p /srv/javafactory/ -buildah run $container -- git clone http://git.argeo.org/apache2/argeo-commons.git /root/dev/git/apache2/argeo-commons -buildah run $container -- "cd /root/dev/git/apache2/argeo-commons && mvn clean argeo-osgi:pde-sources deploy -Prpmbuild" -buildah run $container -- "cd /root/dev/git/apache2/argeo-commons && mvn dependency:go-offline" - -# TODO clean up build directories - -# Configuration -buildah config --workingdir /root/dev/git/ $container - -buildah commit $container argeo2-builder-openjdk:latest diff --git a/dist/containers/argeo2-node b/dist/containers/argeo2-node index fbc4089c2..3e0da2ced 100755 --- a/dist/containers/argeo2-node +++ b/dist/containers/argeo2-node @@ -2,11 +2,11 @@ container=$(buildah from argeo2-tp) -buildah config --label release="1" $container -buildah config --label version="2.1.83,SNAPSHOT" $container - source "$(dirname "$0")/buildah-common" +buildah config --label release="1" $container +buildah config --label version="$VERSION" $container + # Metadata buildah config --label name="argeo2-openjdk11-ubi8" $container buildah config --label summary="Argeo 2 Node based on OpenJDK 11 and Red Hat UBI 8" $container diff --git a/dist/containers/argeo2-tp b/dist/containers/argeo2-tp index cddfe97d1..c2f77bfaa 100755 --- a/dist/containers/argeo2-tp +++ b/dist/containers/argeo2-tp @@ -2,11 +2,11 @@ container=$(buildah from ubi8/ubi-minimal) -buildah config --label release="1" $container -buildah config --label version="2.1.25" $container - source "$(dirname "$0")/buildah-common" +buildah config --label release="1" $container +buildah config --label version="$VERSION_ARGEO_TP" $container + # Metadata buildah config --label name="argeo2-tp-openjdk11-ubi8" $container buildah config --label summary="Argeo 2 OSGi Third Parties based on OpenJDK 11 and Red Hat UBI 8" $container diff --git a/dist/containers/buildah-common b/dist/containers/buildah-common index aa7265e0b..da311af2c 100755 --- a/dist/containers/buildah-common +++ b/dist/containers/buildah-common @@ -3,6 +3,8 @@ ## Log-in to Red Hat registry first # podman login registry.redhat.io +source ./buildah-metadata + # Metadata buildah config --label maintainer="Mathieu Baudier, mbaudier at argeo.org" $container buildah config --created-by "Mathieu Baudier, mbaudier at argeo.org" $container diff --git a/dist/containers/filtered/buildah-metadata b/dist/containers/filtered/buildah-metadata new file mode 100644 index 000000000..2395b01d9 --- /dev/null +++ b/dist/containers/filtered/buildah-metadata @@ -0,0 +1,2 @@ +VERSION=${project.version} +VERSION_ARGEO_TP=${version.argeo-tp} diff --git a/dist/containers/maven.conf b/dist/containers/maven.conf new file mode 100644 index 000000000..e96cfc765 --- /dev/null +++ b/dist/containers/maven.conf @@ -0,0 +1 @@ +JAVA_HOME=/usr/lib/jvm/java-11-openjdk diff --git a/dist/containers/pom.xml b/dist/containers/pom.xml new file mode 100644 index 000000000..32ab16408 --- /dev/null +++ b/dist/containers/pom.xml @@ -0,0 +1,39 @@ + + 4.0.0 + + org.argeo.commons + 2.1.84-SNAPSHOT + dist + .. + + containers + pom + Argeo OCI Containers + + + + maven-resources-plugin + + + copy-resources + validate + + copy-resources + + + ${basedir} + + + filtered + true + + + + + + + + + diff --git a/dist/pom.xml b/dist/pom.xml index 72e52e682..e23da9630 100644 --- a/dist/pom.xml +++ b/dist/pom.xml @@ -13,5 +13,6 @@ osgi-boot argeo-node + containers \ No newline at end of file -- 2.30.2