scripts dockerize
This commit is contained in:
parent
9eac72e0f5
commit
4df7bfa51e
10
Dockerfile
10
Dockerfile
|
@ -7,11 +7,15 @@
|
||||||
# -f Dockerfile \
|
# -f Dockerfile \
|
||||||
# $PLATFORMS .
|
# $PLATFORMS .
|
||||||
|
|
||||||
ARG JAVA_VERSION
|
# ARG JAVA_VERSION
|
||||||
ARG SMARTGEARS_VERSION
|
# ARG SMARTGEARS_VERSION
|
||||||
|
# ARG TOMCAT_VERSION
|
||||||
|
|
||||||
|
ARG SMARTGEAR_IMAGE
|
||||||
|
|
||||||
#FROM d4science/smartgears-distribution:${SMARTGEARS_VERSION}-java${JAVA_VERSION}-tomcat10.1.19
|
#FROM d4science/smartgears-distribution:${SMARTGEARS_VERSION}-java${JAVA_VERSION}-tomcat10.1.19
|
||||||
FROM hub.dev.d4science.org/gcube/smartgears-distribution:${SMARTGEARS_VERSION}-java${JAVA_VERSION}-tomcat10.1.19
|
# FROM hub.dev.d4science.org/gcube/smartgears-distribution:${SMARTGEARS_VERSION}-java${JAVA_VERSION}-tomcat{TOMCAT_VERSION}
|
||||||
|
FROM ${SMARTGEAR_IMAGE}
|
||||||
ARG CONTAINER_INI="./dockerize/configuration/container.ini"
|
ARG CONTAINER_INI="./dockerize/configuration/container.ini"
|
||||||
ARG MVN_FINALNAME
|
ARG MVN_FINALNAME
|
||||||
ARG MVN_NAME
|
ARG MVN_NAME
|
||||||
|
|
|
@ -32,6 +32,7 @@ Help() {
|
||||||
echo "-e execute the docker image"
|
echo "-e execute the docker image"
|
||||||
echo "-g arg specifies the maven [g]oals {package, install, deploy etc} default is $GOAL."
|
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 "-d arg? enable java debug mode for execution"
|
||||||
|
echo " arg is the debug port (default is $DEBUG_PORT)"
|
||||||
|
|
||||||
echo "-r push image to d4science harbo[r] (with login already done, or -l to login)"
|
echo "-r push image to d4science harbo[r] (with login already done, or -l to login)"
|
||||||
echo "-u p[u]sh image to dockerhub (with docker login already done)"
|
echo "-u p[u]sh image to dockerhub (with docker login already done)"
|
||||||
|
@ -40,11 +41,10 @@ Help() {
|
||||||
|
|
||||||
echo "-c arg path of the file to deploy as container.ini (default ./docker/container.ini)"
|
echo "-c arg path of the file to deploy as container.ini (default ./docker/container.ini)"
|
||||||
|
|
||||||
echo "-j arg specify java version (default is $JAVA_VERSION)"
|
# echo "-j arg specify java version (default is $JAVA_VERSION)"
|
||||||
echo " accepted version are: ${ACCEPTED_JAVA_VERSIONs[@]}"
|
# echo " accepted version are: ${ACCEPTED_JAVA_VERSIONs[@]}"
|
||||||
echo " arg is the debug port (default is $DEBUG_PORT)"
|
|
||||||
|
|
||||||
echo "-s skip maven package"
|
echo "-s skip maven execution"
|
||||||
echo "-t exec also maven tests"
|
echo "-t exec also maven tests"
|
||||||
|
|
||||||
echo "-n arg specifies the docker image name (default is $MVN_NAME)."
|
echo "-n arg specifies the docker image name (default is $MVN_NAME)."
|
||||||
|
@ -67,8 +67,8 @@ Help() {
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
#OPTSTRING=":sn:p:d:j:?h"
|
#OPTSTRING=":c:n:p:g:d:?jsmulrteh"
|
||||||
OPTSTRING=":c:n:p:g:d:?jsmulrteh"
|
OPTSTRING=":c:n:p:g:d:?smulrteh"
|
||||||
|
|
||||||
while getopts $OPTSTRING opt; do
|
while getopts $OPTSTRING opt; do
|
||||||
# echo "Option -${opt} was triggered, Argument: ${OPTARG}"
|
# echo "Option -${opt} was triggered, Argument: ${OPTARG}"
|
||||||
|
@ -94,13 +94,13 @@ while getopts $OPTSTRING opt; do
|
||||||
DEBUG_PORT=${OPTARG}
|
DEBUG_PORT=${OPTARG}
|
||||||
echo "debug enabled, port $DEBUG_PORT, execute $EXECUTE"
|
echo "debug enabled, port $DEBUG_PORT, execute $EXECUTE"
|
||||||
;;
|
;;
|
||||||
j)
|
# j)
|
||||||
if [[ ${ACCEPTED_JAVA_VERSIONs[@]} =~ ${OPTARG} ]]; then
|
# if [[ ${ACCEPTED_JAVA_VERSIONs[@]} =~ ${OPTARG} ]]; then
|
||||||
JAVA_VERSION=${OPTARG}
|
# JAVA_VERSION=${OPTARG}
|
||||||
else
|
# else
|
||||||
echo "Invalid java version" && echo "accepted version are: ${ACCEPTED_JAVA_VERSIONs[@]}" && exit 1
|
# echo "Invalid java version" && echo "accepted version are: ${ACCEPTED_JAVA_VERSIONs[@]}" && exit 1
|
||||||
fi
|
# fi
|
||||||
;;
|
# ;;
|
||||||
h) Help && exit 0 ;;
|
h) Help && exit 0 ;;
|
||||||
|
|
||||||
:)
|
:)
|
||||||
|
@ -147,8 +147,7 @@ echo "DOCKER_BUILD_NAME: $DOCKER_BUILD_NAME"
|
||||||
--build-arg="MVN_FINALNAME=$MVN_FINALNAME" \
|
--build-arg="MVN_FINALNAME=$MVN_FINALNAME" \
|
||||||
--build-arg="MVN_NAME=${MVN_NAME}" \
|
--build-arg="MVN_NAME=${MVN_NAME}" \
|
||||||
--build-arg="CONTAINER_INI=${CONTAINER_INI}" \
|
--build-arg="CONTAINER_INI=${CONTAINER_INI}" \
|
||||||
--build-arg="JAVA_VERSION=${JAVA_VERSION}" \
|
--build-arg="SMARTGEAR_IMAGE=${SMARTGEAR_IMAGE}" \
|
||||||
--build-arg="SMARTGEARS_VERSION=${SMARTGEARS_VERSION}" \
|
|
||||||
-f Dockerfile \
|
-f Dockerfile \
|
||||||
$PLATFORMS . );
|
$PLATFORMS . );
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ JAVA_VERSION=$(cd .. && mvn -q \
|
||||||
exec:exec)
|
exec:exec)
|
||||||
echo "JAVA_VERSION: ${JAVA_VERSION}"
|
echo "JAVA_VERSION: ${JAVA_VERSION}"
|
||||||
|
|
||||||
TOMCAT_VERSION=tomcat10.1.19
|
TOMCAT_VERSION=10.1.19
|
||||||
echo "TOMCAT_VERSION: ${TOMCAT_VERSION}"
|
echo "TOMCAT_VERSION: ${TOMCAT_VERSION}"
|
||||||
|
|
||||||
SMARTGEARS_VERSION=$(cd .. && mvn -q \
|
SMARTGEARS_VERSION=$(cd .. && mvn -q \
|
||||||
|
@ -45,7 +45,7 @@ echo "IMAGE_VERSION: ${IMAGE_VERSION}"
|
||||||
DOCKER_BUILD_NAME=$MVN_NAME:$IMAGE_VERSION
|
DOCKER_BUILD_NAME=$MVN_NAME:$IMAGE_VERSION
|
||||||
echo "DOCKER_BUILD_NAME: ${DOCKER_BUILD_NAME}"
|
echo "DOCKER_BUILD_NAME: ${DOCKER_BUILD_NAME}"
|
||||||
|
|
||||||
SMARTGEAR_IMAGE=hub.dev.d4science.org/gcube/smartgears-distribution:${SMARTGEARS_VERSION}-java${JAVA_VERSION}-${TOMCAT_VERSION}
|
SMARTGEAR_IMAGE=hub.dev.d4science.org/gcube/smartgears-distribution:${SMARTGEARS_VERSION}-java${JAVA_VERSION}-tomcat${TOMCAT_VERSION}
|
||||||
echo "SMARTGEAR_IMAGE: ${SMARTGEAR_IMAGE}"
|
echo "SMARTGEAR_IMAGE: ${SMARTGEAR_IMAGE}"
|
||||||
|
|
||||||
DOCKER_IMAGE_NAME=d4science/$DOCKER_BUILD_NAME
|
DOCKER_IMAGE_NAME=d4science/$DOCKER_BUILD_NAME
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -a
|
||||||
|
# source build_conf > docker.conf # generate current conf
|
||||||
|
# source docker.conf
|
||||||
|
source build_conf
|
||||||
|
|
||||||
|
echo "Docker image $HARBOR_IMAGE_NAME"
|
||||||
|
|
||||||
|
docker push $HARBOR_IMAGE_NAME
|
||||||
|
|
||||||
|
set +a
|
Loading…
Reference in New Issue