moved startContainer into a sub folder and created a script to build and

create the docker image
This commit is contained in:
lucio 2024-03-05 15:04:31 +01:00
parent d621e840ba
commit 56a49c1ec5
4 changed files with 68 additions and 7 deletions

View File

@ -1,4 +1,4 @@
FROM tomcat:9.0.85-jdk11-temurin-jammy
FROM tomcat:10.1.19-jdk11-temurin-jammy
ARG filename=smartgears-distribution-4.0.0-SNAPSHOT
ARG version=4.0.0-SNAPSHOT
COPY ./target/$filename.tar.gz /smartgears-distro.tar.gz
@ -10,7 +10,7 @@ FROM tomcat:9.0.85-jdk11-temurin-jammy
RUN mv smartgears-distribution-$version smartgears-distribution
ENV GHN_HOME=./smartgears-distribution
RUN ./smartgears-distribution/install -s tomcat
COPY startContainer.sh /startContainer.sh
COPY exec/startContainer.sh /startContainer.sh
RUN chmod +x /startContainer.sh
ENTRYPOINT ["/startContainer.sh"]
CMD ["catalina.sh","run"]

58
buildDistribution.sh Executable file
View File

@ -0,0 +1,58 @@
#!/bin/bash
################################################################################
# Help #
################################################################################
Help()
{
# Display Help
echo "build and create docker image form smartgears distribution"
echo
echo "Syntax: buildDistribution [-g arg] [-p|u|h]"
echo "options:"
echo "g arg specifies the maven goal {package, install, deploy etc} default is package."
echo "p build docker image for multiple platform (must be suppported by local docker agent)"
echo "u push image to dockerhub (with docker login already done)"
echo "h Print this Help."
echo
}
################################################################################
################################################################################
# Main program #
################################################################################
################################################################################
set -e
image_version=4.0.0-SNAPSHOT-java11-tomcat10.1.19
push=false
while getopts g:puh flag
do
case "${flag}" in
g) goal=${OPTARG};;
p) platform=true ;;
u) push=true ;;
h) Help
exit 0;;
*) echo "Invalid option"
exit 1;;
esac
done
echo "goal: $goal";
echo "platform: $platform";
if [ -z ${goal} ]; then mvn clean package; else mvn clean ${goal}; fi
if [ -z ${platform} ];
then docker build -t smartgears-distribution:${image_version} .;
else docker build -t smartgears-distribution:${image_version} --platform=linux/amd64,linux/arm64,linux/arm/v7 . ;
fi
docker tag smartgears-distribution:${image_version} d4science/smartgears-distribution:${image_version}
if [ ${push} = true ]; then
docker push d4science/smartgears-distribution:${image_version};
fi

13
pom.xml
View File

@ -77,11 +77,6 @@
<groupId>org.gcube.common</groupId>
<artifactId>common-utility-sg4</artifactId>
</dependency>
<dependency>
<groupId>org.gcube.information-system</groupId>
<artifactId>resource-registry-publisher-connector</artifactId>
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.gcube.data.publishing</groupId>
<artifactId>document-store-lib-accounting-service</artifactId>
@ -100,6 +95,14 @@
<classifier>probe</classifier>
<type>war</type>
</dependency>
<!-- publisher connectors -->
<!--
<dependency>
<groupId>org.gcube.information-system</groupId>
<artifactId>resource-registry-publisher-connector</artifactId>
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
</dependency>
-->
<dependency>
<groupId>org.gcube.common.core</groupId>
<artifactId>legacy-is-publisher-connector</artifactId>