From 31340fb85e026efae5564bb25f9fc821e01b17ed Mon Sep 17 00:00:00 2001 From: Alfredo Oliviero Date: Fri, 24 May 2024 16:34:54 +0200 Subject: [PATCH] build and config --- Dockerfile | 4 +--- dockerize/buildImageAndStart.sh | 23 ++++++++++++----------- documentation/sphinx/conf.py | 6 ++---- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4a9e5d3..f53cebc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,9 +15,7 @@ FROM hub.dev.d4science.org/gcube/smartgears-distribution:${SMARTGEARS_VERSION}-j ARG CONTAINER_INI="./dockerize/configuration/container.ini" 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/ diff --git a/dockerize/buildImageAndStart.sh b/dockerize/buildImageAndStart.sh index f4d0d3d..3a06d1d 100755 --- a/dockerize/buildImageAndStart.sh +++ b/dockerize/buildImageAndStart.sh @@ -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 diff --git a/documentation/sphinx/conf.py b/documentation/sphinx/conf.py index f2eb8e6..542d2f6 100644 --- a/documentation/sphinx/conf.py +++ b/documentation/sphinx/conf.py @@ -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")