diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | build4docker.sh | 46 | ||||
-rw-r--r-- | ci/build_docker_image.sh | 10 | ||||
-rw-r--r-- | distributions/msb-discovery/src/main/docker/Dockerfile | 13 |
4 files changed, 22 insertions, 48 deletions
@@ -3,6 +3,7 @@ .settings/ .vscode/ target/ +release/ .vagrant /archives/ *.jar diff --git a/build4docker.sh b/build4docker.sh index 33910d8..8ecd60c 100644 --- a/build4docker.sh +++ b/build4docker.sh @@ -20,48 +20,15 @@ DIRNAME=`dirname $0` RUNHOME=`cd $DIRNAME/; pwd` echo @RUNHOME@ $RUNHOME -echo @JAVA_HOME@ $JAVA_HOME - -#build -mvn clean install - - - -#cooy +#copy RELEASE_BASE_DIR=$RUNHOME/release -CONSUL_RELEASE_DIR=${RELEASE_BASE_DIR}/msb-consul - -rm -rf $CONSUL_RELEASE_DIR -mkdir $CONSUL_RELEASE_DIR -p - -DOCKER_RUN_NAME=msb_consul -DOCKER_IMAGE_NAME=msb_consul -DOCKER_RELEASE_VERSION=0.7.5 - -cp -r $RUNHOME/consul/target/version/* ${CONSUL_RELEASE_DIR} -cp $RUNHOME/ci/build_docker_image.sh ${CONSUL_RELEASE_DIR} -#build docker image -cd ${CONSUL_RELEASE_DIR} -chmod 777 build_docker_image.sh - -#clear old version -docker rm -f ${DOCKER_RUN_NAME} -docker rmi ${DOCKER_IMAGE_NAME}:${DOCKER_RELEASE_VERSION} - - -./build_docker_image.sh -n=${DOCKER_IMAGE_NAME} -v=${DOCKER_RELEASE_VERSION} -d=./docker - -#docker run -docker run -d --net=host --name ${DOCKER_RUN_NAME} ${DOCKER_IMAGE_NAME}:${DOCKER_RELEASE_VERSION} -docker ps |grep ${DOCKER_RUN_NAME} - - RELEASE_DIR=${RELEASE_BASE_DIR}/msb-discovery DOCKER_RUN_NAME=msb_discovery DOCKER_IMAGE_NAME=msb_discovery DOCKER_RELEASE_VERSION=latest +DOCKER_REPOSITORY=nexus3.onap.org:10003 rm -rf $RELEASE_DIR mkdir $RELEASE_DIR -p @@ -74,12 +41,15 @@ cd ${RELEASE_DIR} chmod 777 build_docker_image.sh docker rm -f ${DOCKER_RUN_NAME} -docker rmi ${DOCKER_IMAGE_NAME}:${DOCKER_RELEASE_VERSION} +docker rmi ${DOCKER_REPOSITORY}/onap/msb/${DOCKER_IMAGE_NAME}:${DOCKER_RELEASE_VERSION} -./build_docker_image.sh -n=${DOCKER_IMAGE_NAME} -v=${DOCKER_RELEASE_VERSION} -d=./docker +./build_docker_image.sh -n=${DOCKER_REPOSITORY}/onap/msb/${DOCKER_IMAGE_NAME} -v=${DOCKER_RELEASE_VERSION} -d=./docker #docker run -docker run -d --net=host --name ${DOCKER_RUN_NAME} ${DOCKER_IMAGE_NAME}:${DOCKER_RELEASE_VERSION} +docker run -d --net=host --name ${DOCKER_RUN_NAME} ${DOCKER_REPOSITORY}/onap/msb/${DOCKER_IMAGE_NAME}:${DOCKER_RELEASE_VERSION} docker ps |grep ${DOCKER_RUN_NAME} + +echo "Pushing ${DOCKER_REPOSITORY}/onap/msb/${DOCKER_IMAGE_NAME}:${DOCKER_RELEASE_VERSION}" +docker push ${DOCKER_REPOSITORY}/onap/msb/${DOCKER_IMAGE_NAME}:${DOCKER_RELEASE_VERSION} diff --git a/ci/build_docker_image.sh b/ci/build_docker_image.sh index 7b6b546..3c9f2f2 100644 --- a/ci/build_docker_image.sh +++ b/ci/build_docker_image.sh @@ -24,11 +24,11 @@ if [[ ${NAME} && ${VERSION} && ${DIR} ]]; then echo "begin to build image ${NAME}.." docker build --no-cache -t ${NAME}:${VERSION} . >/dev/null || { echo -e "\nBuild docker image failed!";exit 1; } docker rmi $(docker images | grep "^<none>" | awk '{print $3}') &>/dev/null - docker save -o ${NAME}.tar ${NAME}:${VERSION} >/dev/null || { rm -f ${NAME}.tar &>/dev/null;echo -e "\nSave docker image failed!";exit 1; } - if [ ! -d ${DIR} ]; then - mkdir -p ${DIR} - fi - mv ${NAME}.tar ${DIR}/${NAME}.tar &>/dev/null + # docker save -o ${NAME}.tar ${NAME}:${VERSION} >/dev/null || { rm -f ${NAME}.tar &>/dev/null;echo -e "\nSave docker image failed!";exit 1; } + # if [ ! -d ${DIR} ]; then + # mkdir -p ${DIR} + # fi + # mv ${NAME}.tar ${DIR}/${NAME}.tar &>/dev/null echo "build completes!" else echo "not all -n and -v and -d are provided!" diff --git a/distributions/msb-discovery/src/main/docker/Dockerfile b/distributions/msb-discovery/src/main/docker/Dockerfile index 1f0febe..747790f 100644 --- a/distributions/msb-discovery/src/main/docker/Dockerfile +++ b/distributions/msb-discovery/src/main/docker/Dockerfile @@ -1,7 +1,10 @@ -FROM openjdk:8.0.72
-ENV BASE /opt/application/msb-discover
-ENV LD_LIBRARY_PATH /lib64
-ADD msb-discovery*.tar.gz /opt/application
-WORKDIR /opt/application/msb-discovery
+# Dockerfile - msb-discover
+FROM nexus3.onap.org:10003/onap/msb/msb_base:latest
+COPY msb-discover*.tar.gz /usr/src
+
+RUN tar -xzf /usr/src/msb-discover*.tar.gz -C /usr/local --strip-components=1; \
+ rm /usr/src/msb-discover*.tar.gz
+
+WORKDIR /usr/local
EXPOSE 10081
ENTRYPOINT exec $PWD/startup4docker.sh
\ No newline at end of file |