From 2bb9c251cb17db7849a0a364fbe557175b336402 Mon Sep 17 00:00:00 2001 From: agrawalgaurav Date: Fri, 15 May 2020 20:35:36 +0530 Subject: [PATCH] Image build and push scripts Change-Id: I8b3525e61c083d2fa82195ad5e08e72ba58301a7 --- .../docker-build.sh => broker/build_image.sh} | 15 ++++++-- mecm/mepm/applcm/broker/build_push_image.sh | 41 ++++++++++++++++++++++ mecm/mepm/applcm/k8shelm/build_image.sh | 28 +++++++++++++++ mecm/mepm/applcm/k8shelm/build_push_image.sh | 41 ++++++++++++++++++++++ .../deployment/build_push_image.sh} | 19 ++++++++-- .../resources/test/{Build-Run.sh => build_run.sh} | 0 6 files changed, 139 insertions(+), 5 deletions(-) rename mecm/mepm/applcm/{k8shelm/docker-build.sh => broker/build_image.sh} (66%) create mode 100644 mecm/mepm/applcm/broker/build_push_image.sh create mode 100755 mecm/mepm/applcm/k8shelm/build_image.sh create mode 100644 mecm/mepm/applcm/k8shelm/build_push_image.sh rename mecm/mepm/applcm/{broker/docker-build.sh => resources/deployment/build_push_image.sh} (68%) mode change 100755 => 100644 rename mecm/mepm/applcm/resources/test/{Build-Run.sh => build_run.sh} (100%) diff --git a/mecm/mepm/applcm/k8shelm/docker-build.sh b/mecm/mepm/applcm/broker/build_image.sh similarity index 66% rename from mecm/mepm/applcm/k8shelm/docker-build.sh rename to mecm/mepm/applcm/broker/build_image.sh index f0a70e5..838053d 100755 --- a/mecm/mepm/applcm/k8shelm/docker-build.sh +++ b/mecm/mepm/applcm/broker/build_image.sh @@ -13,5 +13,16 @@ # See the License for the specific language governing permissions and # limitations under the License. -MEP_VERSION=latest -docker build --no-cache -t ealtedge/helmplugin:${MEP_VERSION} -f build/Dockerfile . +DOCKER_BUILD_DIR=`pwd` +MECM_VERSION=latest +IMAGE_NAME=applcm-broker +REPO_NAME=ealtedge + +echo "DOCKER_BUILD_DIR=${DOCKER_BUILD_DIR}" +echo "In Build and Push Broker" + +function build_image { + docker build --no-cache -t ${REPO_NAME}/${IMAGE_NAME}:${MECM_VERSION} -f build/Dockerfile . +} + +build_image diff --git a/mecm/mepm/applcm/broker/build_push_image.sh b/mecm/mepm/applcm/broker/build_push_image.sh new file mode 100644 index 0000000..e4ecbdd --- /dev/null +++ b/mecm/mepm/applcm/broker/build_push_image.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# Copyright 2020 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. + +unset REPO_USER +unset REPO_PWD +echo -n "REPO_USER:" +read REPO_USER +echo -n "REPO_PWD:" +read REPO_PWD + +DOCKER_BUILD_DIR=`pwd` +MECM_VERSION=latest +IMAGE_NAME=applcm-broker +REPO_NAME=ealtedge + +echo "DOCKER_BUILD_DIR=${DOCKER_BUILD_DIR}" +echo "In Build and Push Broker" + +function build_image { + docker build --no-cache -t ${REPO_NAME}/${IMAGE_NAME}:${MECM_VERSION} -f build/Dockerfile . +} + +function push_image { + docker login -u ${REPO_USER} -p ${REPO_PWD} + docker push ${REPO_NAME}/${IMAGE_NAME}:${MECM_VERSION} +} + +build_image +push_image \ No newline at end of file diff --git a/mecm/mepm/applcm/k8shelm/build_image.sh b/mecm/mepm/applcm/k8shelm/build_image.sh new file mode 100755 index 0000000..15c94cb --- /dev/null +++ b/mecm/mepm/applcm/k8shelm/build_image.sh @@ -0,0 +1,28 @@ +#!/bin/sh +# Copyright 2020 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. + +DOCKER_BUILD_DIR=`pwd` +MECM_VERSION=latest +IMAGE_NAME=helmplugin +REPO_NAME=ealtedge + +echo "DOCKER_BUILD_DIR=${DOCKER_BUILD_DIR}" +echo "In Build and Push K8s Help Plugin" + +function build_image { + docker build --no-cache -t ${REPO_NAME}/${IMAGE_NAME}:${MECM_VERSION} -f build/Dockerfile . +} + +build_image diff --git a/mecm/mepm/applcm/k8shelm/build_push_image.sh b/mecm/mepm/applcm/k8shelm/build_push_image.sh new file mode 100644 index 0000000..2d3e4cd --- /dev/null +++ b/mecm/mepm/applcm/k8shelm/build_push_image.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# Copyright 2020 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. + +unset REPO_USER +unset REPO_PWD +echo -n "REPO_USER:" +read REPO_USER +echo -n "REPO_PWD:" +read REPO_PWD + +DOCKER_BUILD_DIR=`pwd` +MECM_VERSION=latest +IMAGE_NAME=helmplugin +REPO_NAME=ealtedge + +echo "DOCKER_BUILD_DIR=${DOCKER_BUILD_DIR}" +echo "In Build and Push K8s Helm Plugin" + +function build_image { + docker build --no-cache -t ${REPO_NAME}/${IMAGE_NAME}:${MECM_VERSION} -f build/Dockerfile . +} + +function push_image { + docker login -u ${REPO_USER} -p ${REPO_PWD} + docker push ${REPO_NAME}/${IMAGE_NAME}:${MECM_VERSION} +} + +build_image +push_image \ No newline at end of file diff --git a/mecm/mepm/applcm/broker/docker-build.sh b/mecm/mepm/applcm/resources/deployment/build_push_image.sh old mode 100755 new mode 100644 similarity index 68% rename from mecm/mepm/applcm/broker/docker-build.sh rename to mecm/mepm/applcm/resources/deployment/build_push_image.sh index 6f6bf8b..24ffcb3 --- a/mecm/mepm/applcm/broker/docker-build.sh +++ b/mecm/mepm/applcm/resources/deployment/build_push_image.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # Copyright 2020 Huawei Technologies Co., Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,5 +13,18 @@ # See the License for the specific language governing permissions and # limitations under the License. -MEP_VERSION=latest -docker build --no-cache -t ealtedge/applcm-broker:${MEP_VERSION} -f build/Dockerfile . +CURRENT_DIR=`pwd` + +echo "DOCKER_BUILD_DIR=${CURRENT_DIR}" +echo "Build and Push APP LCM" + +# Build and push broker +cd ${CURRENT_DIR} +cd ../../broker/ +. build_push_image.sh + +# Build and push k8s helm plugin +cd ${CURRENT_DIR} +cd ../../k8shelm/ +. build_push_image.sh + diff --git a/mecm/mepm/applcm/resources/test/Build-Run.sh b/mecm/mepm/applcm/resources/test/build_run.sh similarity index 100% rename from mecm/mepm/applcm/resources/test/Build-Run.sh rename to mecm/mepm/applcm/resources/test/build_run.sh -- 2.16.6