build and config

This commit is contained in:
Alfredo Oliviero 2024-05-24 16:34:54 +02:00
parent 1afbb2ecb8
commit 31340fb85e
3 changed files with 15 additions and 18 deletions

View File

@ -16,8 +16,6 @@ FROM hub.dev.d4science.org/gcube/smartgears-distribution:${SMARTGEARS_VERSION}-j
ARG MVN_FINALNAME
ARG MVN_NAME
RUN apt-get update
RUN apt-get install unzip
#FROM smartgears-distribution:${SMARTGEARS_VERSION}-java${JAVA_VERSION}-tomcat10.1.19
COPY ./dockerize/configuration/logback.xml /etc/

View File

@ -13,6 +13,8 @@ EXECUTE=false
TEST=false
COMPILE=true
GOAL="clean package"
PUSH_DOCKER=false
PUSH_HARBOR=false
LOGIN_HARBOR=false
@ -28,6 +30,7 @@ Help() {
echo "options:"
echo "-e execute the docker image"
echo "-g arg specifies the maven [g]oals {package, install, deploy etc} default is $GOAL."
echo "-d arg? enable java debug mode for execution"
echo "-r push image to d4science harbo[r] (with login already done, or -l to login)"
@ -65,12 +68,13 @@ Help() {
set -e
#OPTSTRING=":sn:p:d:j:?h"
OPTSTRING=":c:n:p:d:?jsmulrteh"
OPTSTRING=":c:n:p:g:d:?jsmulrteh"
while getopts $OPTSTRING opt; do
# echo "Option -${opt} was triggered, Argument: ${OPTARG}"
case "${opt}" in
s) COMPILE=false && echo "compile $COMPILE" ;;
g) GOAL=${OPTARG} ;;
c)
CONTAINER_INI=${OPTARG}
echo "CONTAINER_INI: $CONTAINER_INI"
@ -119,13 +123,12 @@ while getopts $OPTSTRING opt; do
done
if [ $COMPILE = true ]; then
cd ..
SKIP_TEST=""
if [ $TEST = false ]; then
mvn clean package -Dmaven.test.skip
else
mvn clean package
SKIP_TEST="-Dmaven.test.skip"
fi
cd -
( cd .. && mvn $GOAL $SKIP_TEST );
else
echo "skipping mvn package"
fi
@ -139,17 +142,15 @@ if [ $MULTI_PLATFORM ]; then
fi
echo "DOCKER_BUILD_NAME: $DOCKER_BUILD_NAME"
cd ..
docker build -t $DOCKER_BUILD_NAME \
( cd .. && docker build -t $DOCKER_BUILD_NAME \
--build-arg="MVN_FINALNAME=$MVN_FINALNAME" \
--build-arg="MVN_NAME=${MVN_NAME}" \
--build-arg="CONTAINER_INI=${CONTAINER_INI}" \
--build-arg="JAVA_VERSION=${JAVA_VERSION}" \
--build-arg="SMARTGEARS_VERSION=${SMARTGEARS_VERSION}" \
-f Dockerfile \
$PLATFORMS .
cd -
$PLATFORMS . );
if [ ${PUSH_DOCKER} = true ]; then
docker tag $DOCKER_BUILD_NAME $DOCKER_IMAGE_NAME

View File

@ -14,19 +14,17 @@ import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
_pom_path = "../.."
_POM_PATH = "../.."
def getMvnVariable(variable):
cmd = """cd %s && mvn -q \
-Dexec.executable=echo \
-Dexec.args='${project.%s}' \
--non-recursive \
exec:exec""" % (_pom_path, variable)
exec:exec""" % (_POM_PATH, variable)
stream = os.popen(cmd)
return stream.read().strip()
# -- Project information -----------------------------------------------------
# The full version, including alpha/beta/rc tags
release = getMvnVariable("version")