buildDistribution.sh output

This commit is contained in:
Alfredo Oliviero 2024-05-07 15:02:57 +02:00
parent abd273cc0b
commit 6bc3bd6714
1 changed files with 18 additions and 7 deletions

View File

@ -21,8 +21,12 @@ Help()
echo "-u p[u]sh image to dockerhub (with docker login already done)"
echo "-h Print this [h]elp."
echo
echo "to build a multiplatform image and push on d4science harbor"
echo "./buid ./buildDistribution.sh -m -l -p"
}
################################################################################
################################################################################
# Main program #
@ -62,21 +66,27 @@ done
IMAGE_VERSION=${SMARTGEARS_VERSION}-java${JAVA_VERSION}-tomcat${TOMCAT_VERSION}
echo "IMAGE_VERSION=$IMAGE_VERSION"
BUILD_NAME=smartgears-distribution:$IMAGE_VERSION
if [ -z $GOAL ];
then mvn clean package;
else mvn clean ${GOAL};
fi
if [ -z $MULTI_PLATFORM ];
then docker build -t smartgears-distribution:$IMAGE_VERSION --build-arg JAVA_VERSION=${JAVA_VERSION} .;
else docker build -t smartgears-distribution:$IMAGE_VERSION --build-arg JAVA_VERSION=${JAVA_VERSION} --platform=linux/amd64,linux/arm64,linux/arm/v7 . ;
then docker build -t $BUILD_NAME --build-arg JAVA_VERSION=${JAVA_VERSION} .;
else docker build -t $BUILD_NAME --build-arg JAVA_VERSION=${JAVA_VERSION} --platform=linux/amd64,linux/arm64,linux/arm/v7 . ;
echo ">>> generated docker image ${IMAGE_VERSION}"
fi
if [ ${PUSH_DOCKER} = true ];
then
docker tag smartgears-distribution:$IMAGE_VERSION d4science/smartgears-distribution:$IMAGE_VERSION;
docker push d4science/smartgears-distribution:$IMAGE_VERSION;
DOCKER_NAME = d4science/$BUILD_NAME
docker tag $BUILD_NAME $DOCKER_NAME;
docker push $DOCKER_NAME;
echo ">>> pushed on dockerhub the image $DOCKER_NAME"
fi
if [ ${LOGIN_HARBOR} = true ];
@ -86,8 +96,9 @@ fi
if [ ${PUSH_HARBOR} = true ];
then
docker tag smartgears-distribution:$IMAGE_VERSION hub.dev.d4science.org/gcube/smartgears-distribution:$IMAGE_VERSION;
docker push hub.dev.d4science.org/gcube/smartgears-distribution:$IMAGE_VERSION;
HARBOR_NAME=hub.dev.d4science.org/gcube/$BUILD_NAME
docker tag $BUILD_NAME $HARBOR_NAME;
docker push $HARBOR_NAME;
echo ">>> pushed on hub.dev.d4science.org the image $HARBOR_NAME"
fi
echo "generated docker image ${IMAGE_VERSION}"