diff --git a/api/build.sh b/api/build.sh index 390fbaca2..af75324b0 100644 --- a/api/build.sh +++ b/api/build.sh @@ -25,6 +25,9 @@ function build_api(){ envarg="default-ee" } docker build -f ./Dockerfile --build-arg envarg=$envarg -t ${DOCKER_REPO:-'local'}/chalice:${git_sha1} . + [[ $PUSH_IMAGE -eq 1 ]] && { + docker push ${DOCKER_REPO:-'local'}/chalice:${git_sha1} + } } check_prereq diff --git a/backend/build.sh b/backend/build.sh index 6d7e9467e..c760c1b9b 100644 --- a/backend/build.sh +++ b/backend/build.sh @@ -27,11 +27,17 @@ function build_api(){ [[ $2 != "" ]] && { image="$2" docker build -t ${DOCKER_REPO:-'local'}/$image:${git_sha1} --build-arg SERVICE_NAME=$image . + [[ $PUSH_IMAGE -eq 1 ]] && { + docker push ${DOCKER_REPO:-'local'}/$image:${git_sha1} + } return } for image in $(ls services); do docker build -t ${DOCKER_REPO:-'local'}/$image:${git_sha1} --build-arg SERVICE_NAME=$image . + [[ $PUSH_IMAGE -eq 1 ]] && { + docker push ${DOCKER_REPO:-'local'}/$image:${git_sha1} + } echo "::set-output name=image::${DOCKER_REPO:-'local'}/$image:${git_sha1}" done } diff --git a/scripts/helm/build_deploy.sh b/scripts/helm/build_deploy.sh new file mode 100644 index 000000000..7e9781231 --- /dev/null +++ b/scripts/helm/build_deploy.sh @@ -0,0 +1,16 @@ +#!/bin/bash +set -e + +# This script will build and push docker image to registry + +echo $DOCKER_REPO +[[ -z DOCKER_REPO ]] && { + echo Set DOCKER_REPO="your docker registry" + exit 1 +} || { + docker login $DOCKER_REPO + cd ../../api + PUSH_IMAGE=1 bash build.sh + cd ../backend + PUSH_IMAGE=1 bash build.sh +}