diff options
author | luxin <luxin7@huawei.com> | 2017-09-05 11:42:23 +0800 |
---|---|---|
committer | luxin <luxin7@huawei.com> | 2017-09-05 11:42:23 +0800 |
commit | a1ec4d2c25fca06707f4dfa54fa6fdec6e24f925 (patch) | |
tree | 5547efdfae83d07fb56ea441d1127299a38ab6e4 /huawei/vnfmadapter/VnfmadapterService/deployment/src | |
parent | bc383afdc23b3fa3d1f61248f2dade731d799690 (diff) |
Add huawei vnfmdriver build docker shell
Change-Id: I9b2fd18791cffee595741f8a7760fa51a45c737a
Issue-Id:VFC-273
Signed-off-by: luxin <luxin7@huawei.com>
Diffstat (limited to 'huawei/vnfmadapter/VnfmadapterService/deployment/src')
4 files changed, 141 insertions, 0 deletions
diff --git a/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release/docker/build_image.sh b/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release/docker/build_image.sh new file mode 100644 index 00000000..b83cf6cd --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release/docker/build_image.sh @@ -0,0 +1,34 @@ +#!/bin/bash +DIRNAME=`dirname $0` +DOCKER_BUILD_DIR=`cd $DIRNAME/; pwd` +echo "DOCKER_BUILD_DIR=${DOCKER_BUILD_DIR}" +cd ${DOCKER_BUILD_DIR} + +BUILD_ARGS="--no-cache" +ORG="onap" +VERSION="1.0.0-SNAPSHOT" +PROJECT="vfc" +IMAGE="nfvo/svnfm/huawei" +DOCKER_REPOSITORY="nexus3.onap.org:10003" +IMAGE_NAME="${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/${IMAGE}" + +if [ $HTTP_PROXY ]; then + BUILD_ARGS+=" --build-arg HTTP_PROXY=${HTTP_PROXY}" +fi +if [ $HTTPS_PROXY ]; then + BUILD_ARGS+=" --build-arg HTTPS_PROXY=${HTTPS_PROXY}" +fi + +function build_image { + echo "Start build docker image: ${IMAGE_NAME}" + docker build ${BUILD_ARGS} -t ${IMAGE_NAME}:${VERSION} -t ${IMAGE_NAME}:latest . +} + +function push_image { + echo "Start push docker image: ${IMAGE_NAME}" + docker push ${IMAGE_NAME}:${VERSION} + docker push ${IMAGE_NAME}:latest +} + +build_image +push_image diff --git a/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release/docker/docker-entrypoint.sh b/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release/docker/docker-entrypoint.sh new file mode 100644 index 00000000..756024c8 --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release/docker/docker-entrypoint.sh @@ -0,0 +1,68 @@ +#!/bin/bash +# +# Copyright 2017 Huawei Technologies Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# This file was auto-generated by gen-all-dockerfiles.sh; do not modify manually. +# +# nfvo-driver-vnfm-huawei/target/docker-entrypoint.sh +# + +if [ -z "$SERVICE_IP" ]; then + export SERVICE_IP=`hostname -i` +fi +echo +echo Environment Variables: +echo "SERVICE_IP=$SERVICE_IP" + +#if [ -z "$MSB_ADDR" ]; then +# echo "Missing required variable MSB_ADDR: Microservices Service Bus address <ip>:<port>" +# exit 1 +#fi +#echo "MSB_ADDR=$MSB_ADDR" +#echo + +## Wait for MSB initialization +#echo Wait for MSB initialization +#for i in {1..20}; do +# curl -sS -m 1 $MSB_ADDR > /dev/null && break +# sleep $i +#done + +echo + +# Configure service based on docker environment variables +./instance-config.sh + +# Start mysql +su mysql -c /usr/bin/mysqld_safe & + +# Perform one-time config +if [ ! -e init.log ]; then + # Perform workarounds due to defects in release binary + ./instance-workaround.sh + + # Init mysql; set root password + ./init-mysql.sh + + # microservice-specific one-time initialization + ./instance-init.sh + + date > init.log +fi + +# Start the microservice +./instance-run.sh + diff --git a/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release/docker/instance-run.sh b/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release/docker/instance-run.sh new file mode 100644 index 00000000..2c77db92 --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release/docker/instance-run.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# +# Copyright 2016-2017 Huawei Technologies Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Start microservice +cd bin +./start.sh +while [ ! -e ../logs/vnfmadapterservice.log ]; do + sleep 1 +done +tail -F ../logs/vnfmadapterservice.log diff --git a/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release/docker/instance-workaround.sh b/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release/docker/instance-workaround.sh new file mode 100644 index 00000000..40058f56 --- /dev/null +++ b/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release/docker/instance-workaround.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# +# Copyright 2017 Huawei Technologies Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# |