Fully working OCI containers build based on buildah.
authorMathieu Baudier <mbaudier@argeo.org>
Tue, 17 Dec 2019 15:18:23 +0000 (16:18 +0100)
committerMathieu Baudier <mbaudier@argeo.org>
Tue, 17 Dec 2019 15:18:23 +0000 (16:18 +0100)
dist/containers/argeo2-builder
dist/containers/argeo2-java [new file with mode: 0755]
dist/containers/argeo2-node
dist/containers/argeo2-tp
dist/containers/buildah-common
dist/containers/filtered/buildah-metadata

index e0f8f1be9f247e2c25cd2acbed444beea35fc31c..994272568c32392ec44745b1830b2440f1c4a430 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
-container=$(buildah from ubi8/ubi-minimal)
-
+source "$(dirname "$0")/buildah-metadata"
+container=$(buildah from argeo2-java:openjdk-v$VERSION_JAVA)
 
 source "$(dirname "$0")/buildah-common"
 
@@ -9,37 +9,46 @@ 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
+buildah config --label name="argeo2-builder" $container
+buildah config --label description="Argeo 2 Builder" $container
 
 # Utilities
 #buildah run $container -- microdnf -y install git
-
 # Java 11
-buildah run $container -- microdnf -y install java-11-openjdk-devel
+#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 -- microdnf -y install maven
+#buildah copy $container maven.conf /etc/java/maven.conf
+
+buildah run $container -- microdnf -y install tar gzip
+buildah copy $container https://archive.apache.org/dist/maven/maven-3/$VERSION_MAVEN/binaries/apache-maven-$VERSION_MAVEN-bin.tar.gz /opt
+buildah run $container -- tar -C /opt -xzf /opt/apache-maven-$VERSION_MAVEN-bin.tar.gz
+buildah run $container -- rm -f /opt/apache-maven-$VERSION_MAVEN-bin.tar.gz
+buildah run $container -- microdnf -y remove tar gzip
+
+buildah run $container -- ln -s /opt/apache-maven-$VERSION_MAVEN/bin/mvn /usr/local/bin/mvn
+# Maven script requires which
+buildah run $container -- microdnf -y install which
 
 buildah run $container -- mkdir -p /srv/javafactory/
 
 # Working dir
-buildah run $container -- mkdir -p /root/checkout/
-buildah config --workingdir /root/checkout/ $container
+buildah run $container -- mkdir -p /root/build/
+buildah config --workingdir /root/build/ $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
+buildah copy $container ../.. /root/build
+buildah run $container -- mvn clean install
+#buildah run $container -- 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/
+buildah run $container -- rm -rf /root/.m2/repository/org/argeo/commons
+buildah run $container -- rm -rf /root/build
+buildah run $container -- mkdir -p /root/build/
 
 # 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 config --entrypoint '["mvn","clean","install"]' $container
 
-buildah commit $container argeo2-builder:latest
+buildah commit --rm --format docker $container argeo2-builder:maven-v$VERSION_MAVEN
+buildah push argeo2-builder:maven-v$VERSION_MAVEN docker://argeo/argeo2-builder:maven-v$VERSION_MAVEN
+buildah push argeo2-builder:maven-v$VERSION_MAVEN docker://argeo/argeo2-builder:latest
diff --git a/dist/containers/argeo2-java b/dist/containers/argeo2-java
new file mode 100755 (executable)
index 0000000..801d919
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+source "$(dirname "$0")/buildah-metadata"
+container=$(buildah from ubi8/ubi-minimal)
+
+source "$(dirname "$0")/buildah-common"
+
+buildah config --label release="1" $container
+buildah config --label version="$VERSION_JAVA" $container
+
+# Metadata
+buildah config --label name="argeo2-java" $container
+buildah config --label description="OpenJDK 11 headless on Red Hat UBI 8" $container
+buildah config --label url=https://hub.docker.com/repository/docker/argeo/argeo2-java $container
+
+# Java 11
+buildah run $container -- microdnf install java-11-openjdk-headless
+
+# Configuration
+buildah config --entrypoint '["java"]' $container
+
+buildah commit --rm --format docker $container argeo2-java:openjdk-v$VERSION_JAVA
+buildah push argeo2-java:openjdk-v$VERSION_JAVA docker://argeo/argeo2-java:openjdk-v$VERSION_JAVA
+buildah push argeo2-java:openjdk-v$VERSION_JAVA docker://argeo/argeo2-java:latest
index 3e0da2ced98c520c31bd710e6b2ca02fdf53362b..c55747f6a4e768f3aac59c7cc0d85e49a14a7fed 100755 (executable)
@@ -1,6 +1,10 @@
 #!/bin/sh
 
-container=$(buildah from argeo2-tp)
+source "$(dirname "$0")/buildah-metadata"
+container=$(buildah from argeo2-tp:v$VERSION_ARGEO_TP)
+
+# Override version
+VERSION=2.1.83
 
 source "$(dirname "$0")/buildah-common"
 
@@ -8,12 +12,15 @@ 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
+buildah config --label name="argeo2-node" $container
+buildah config --label description="Argeo 2 Node based on OpenJDK 11 and Red Hat UBI 8" $container
+buildah config --label url=https://hub.docker.com/repository/docker/argeo/argeo2-node $container
 
 # Required as long as we declare an 'argeo' user
 buildah run $container -- microdnf install shadow-utils
 
+# Argeo OSGi Boot
+buildah run $container -- microdnf install osgi-boot
 # Argeo Node
 buildah run $container -- microdnf install argeo-cms-e4-rap argeo-node
 
@@ -21,4 +28,6 @@ buildah run $container -- microdnf install argeo-cms-e4-rap argeo-node
 buildah config --entrypoint '["/usr/sbin/argeoctl","start"]' $container
 buildah config --port 8080 $container
 
-buildah commit $container argeo2-node:latest
+buildah commit --rm --format docker $container argeo2-node:v$VERSION
+buildah push argeo2-node:v$VERSION docker://argeo/argeo2-node:v$VERSION
+buildah push argeo2-node:v$VERSION docker://argeo/argeo2-node:latest
index c2f77bfaaa1a2dae42221f4db4dd6668075c4828..bf3994993fda5c883e7c00e819732ae8fc874baa 100755 (executable)
@@ -1,6 +1,7 @@
 #!/bin/sh
 
-container=$(buildah from ubi8/ubi-minimal)
+source "$(dirname "$0")/buildah-metadata"
+container=$(buildah from argeo2-java:openjdk-v$VERSION_JAVA)
 
 source "$(dirname "$0")/buildah-common"
 
@@ -8,22 +9,20 @@ 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
-
-# Java 11
-buildah run $container -- microdnf install java-11-openjdk-headless
+buildah config --label name="argeo2-tp" $container
+buildah config --label description="Argeo 2 OSGi Third Parties" $container
+buildah config --label url=https://hub.docker.com/repository/docker/argeo/argeo2-tp $container
 
 # Argeo
 buildah run $container -- rpm -Uvh http://repo.argeo.org/rpm/argeo2-release-latest-7.noarch.rpm
 # Argeo Third Parties
 buildah run $container -- microdnf install argeo-cms-e4-rap-tp osgi-boot-equinox
-# Argeo OSGi Boot
-buildah run $container -- microdnf install osgi-boot
 
 # Configuration
 buildah config --entrypoint '["java","-Dosgi.bundles=org.argeo.osgi.boot.jar@start","-Dosgi.configuration=/var/lib/argeo/state","-Dosgi.data=/var/lib/argeo/data","-jar","/usr/share/osgi/boot/org.eclipse.osgi.jar","-console","2323"]' $container
 buildah config --workingdir /var/lib/argeo $container
 buildah config --volume /var/lib/argeo $container
 
-buildah commit $container argeo2-tp:latest
+buildah commit --rm --format docker $container argeo2-tp:v$VERSION_ARGEO_TP
+buildah push argeo2-tp:v$VERSION_ARGEO_TP docker://argeo/argeo2-tp:v$VERSION_ARGEO_TP
+buildah push argeo2-tp:v$VERSION_ARGEO_TP docker://argeo/argeo2-tp:latest
index da311af2c3870c3e7f2747f44591af439644571c..0465d8717421c8cf20ea1d37aa98c191284fb027 100755 (executable)
@@ -3,10 +3,21 @@
 ## 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
 buildah config --author "Argeo GmbH, http://www.argeo.org, contact at argeo.org" $container
 buildah config --label vendor="Argeo GmbH" $container
+
+# Remove Red Hat labels
+buildah config --label authoritative-source-url= $container
+buildah config --label com.redhat.build-host= $container
+buildah config --label com.redhat.component= $container
+buildah config --label com.redhat.license_terms= $container
+buildah config --label io.k8s.description= $container
+buildah config --label io.k8s.display-name= $container
+buildah config --label io.openshift.expose-services= $container
+buildah config --label io.openshift.tags= $container
+buildah config --label vcs-ref= $container
+buildah config --label vcs-type= $container
+buildah config --label summary= $container
index 2395b01d97ff0ffcfc59d71faa330d833000cd85..fd437d928bad282317f07a734c3b5bbeaf7e157c 100644 (file)
@@ -1,2 +1,5 @@
 VERSION=${project.version}
 VERSION_ARGEO_TP=${version.argeo-tp}
+
+VERSION_MAVEN=3.5.4
+VERSION_JAVA=11.0.5