You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2022/07/01 20:19:47 UTC
[activemq-artemis-native] 01/02: Compilation script using podman
This is an automated email from the ASF dual-hosted git repository.
clebertsuconic pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis-native.git
commit 2b89b0fb4c96b9c82e6b775a46edd8ce2fc4554c
Author: clebert <cl...@gmail.com>
AuthorDate: Fri Jul 1 13:22:27 2022 -0400
Compilation script using podman
---
pom.xml | 24 +++++++++++
.../Dockerfile-centos => scripts/bash-podman.sh | 46 ++++++++-------------
.../compile-using-podman.sh | 47 +++++++++-------------
src/main/docker/Dockerfile-centos | 2 +-
4 files changed, 60 insertions(+), 59 deletions(-)
diff --git a/pom.xml b/pom.xml
index 4d4a6de..3d43076 100644
--- a/pom.xml
+++ b/pom.xml
@@ -140,6 +140,30 @@
</plugins>
</build>
</profile>
+ <profile>
+ <id>podman</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>build</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>exec</goal>
+ </goals>
+ <configuration>
+ <executable>bash</executable>
+ <commandlineArgs>./scripts/compile-using-podman.sh</commandlineArgs>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
<profile>
<id>docker</id>
<build>
diff --git a/src/main/docker/Dockerfile-centos b/scripts/bash-podman.sh
old mode 100644
new mode 100755
similarity index 52%
copy from src/main/docker/Dockerfile-centos
copy to scripts/bash-podman.sh
index c0dd8e2..45b1aa3
--- a/src/main/docker/Dockerfile-centos
+++ b/scripts/bash-podman.sh
@@ -1,3 +1,4 @@
+#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -5,9 +6,9 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -15,31 +16,18 @@
# specific language governing permissions and limitations
# under the License.
-# ActiveMQ Artemis
+if [ -d "./target" ]; then
+ if [ -d "./target/lib" ]; then
+ rm -rf "./target/lib"
+ fi
+ mkdir "target/lib"
+else
+ mkdir -p "target/lib"
+fi
+
+podman build -f src/main/docker/Dockerfile-centos -t artemis-native-builder .
+# to debug the image
+podman run -it --rm -v $PWD/target/lib:/work/target/lib:Z artemis-native-builder "$@" bash
+chown -Rv $USER:$GID ./target/lib
+ls -liat ./target/lib
-FROM centos:7 as builder-env
-
-LABEL maintainer="Apache ActiveMQ Team"
-
-RUN yum groupinstall -y "Development Tools" && \
- yum install -y vim cmake libaio libaio.i686 libaio-devel libaio-devel.i686 glibc-devel.i686 \
- libgcc.i686 java-1.8.0-openjdk-devel && yum clean all
-
-WORKDIR /opt
-RUN curl https://downloads.apache.org/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz | tar -xz
-RUN echo 'PATH=/opt/apache-maven-3.6.3/bin/:$PATH' >> ~/.bashrc
-
-FROM builder-env as builder
-
-ADD . /work
-
-WORKDIR /work
-
-VOLUME ["/work/target/lib"]
-VOLUME ["/root/.m2/repository"]
-
-WORKDIR /work
-
-ENV PATH /opt/apache-maven-3.6.3/bin/:$PATH
-
-CMD [ "bash", "-c", "/work/scripts/compile-native.sh"]
diff --git a/src/main/docker/Dockerfile-centos b/scripts/compile-using-podman.sh
old mode 100644
new mode 100755
similarity index 52%
copy from src/main/docker/Dockerfile-centos
copy to scripts/compile-using-podman.sh
index c0dd8e2..b6f1013
--- a/src/main/docker/Dockerfile-centos
+++ b/scripts/compile-using-podman.sh
@@ -1,3 +1,4 @@
+#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -5,9 +6,9 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -15,31 +16,19 @@
# specific language governing permissions and limitations
# under the License.
-# ActiveMQ Artemis
+if [ -d "./target" ]; then
+ if [ -d "./target/lib" ]; then
+ rm -rf "./target/lib"
+ fi
+ mkdir "target/lib"
+else
+ mkdir -p "target/lib"
+fi
+
+podman build -f src/main/docker/Dockerfile-centos -t artemis-native-builder .
+podman run --rm -v $PWD/target/lib:/work/target/lib:Z artemis-native-builder "$@"
+# to debug the image
+#podman run -it --rm -v $PWD/target/lib:/work/target/lib:Z artemis-native-builder "$@" bash
+chown -Rv $USER:$GID ./target/lib
+ls -liat ./target/lib
-FROM centos:7 as builder-env
-
-LABEL maintainer="Apache ActiveMQ Team"
-
-RUN yum groupinstall -y "Development Tools" && \
- yum install -y vim cmake libaio libaio.i686 libaio-devel libaio-devel.i686 glibc-devel.i686 \
- libgcc.i686 java-1.8.0-openjdk-devel && yum clean all
-
-WORKDIR /opt
-RUN curl https://downloads.apache.org/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz | tar -xz
-RUN echo 'PATH=/opt/apache-maven-3.6.3/bin/:$PATH' >> ~/.bashrc
-
-FROM builder-env as builder
-
-ADD . /work
-
-WORKDIR /work
-
-VOLUME ["/work/target/lib"]
-VOLUME ["/root/.m2/repository"]
-
-WORKDIR /work
-
-ENV PATH /opt/apache-maven-3.6.3/bin/:$PATH
-
-CMD [ "bash", "-c", "/work/scripts/compile-native.sh"]
diff --git a/src/main/docker/Dockerfile-centos b/src/main/docker/Dockerfile-centos
index c0dd8e2..9084ebb 100644
--- a/src/main/docker/Dockerfile-centos
+++ b/src/main/docker/Dockerfile-centos
@@ -23,7 +23,7 @@ LABEL maintainer="Apache ActiveMQ Team"
RUN yum groupinstall -y "Development Tools" && \
yum install -y vim cmake libaio libaio.i686 libaio-devel libaio-devel.i686 glibc-devel.i686 \
- libgcc.i686 java-1.8.0-openjdk-devel && yum clean all
+ libgcc.i686 java-11-openjdk-devel && yum clean all
WORKDIR /opt
RUN curl https://downloads.apache.org/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz | tar -xz