chore(build): script to build and push docker images.
This commit is contained in:
parent
91cbd593b8
commit
409d071aac
3 changed files with 25 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
16
scripts/helm/build_deploy.sh
Normal file
16
scripts/helm/build_deploy.sh
Normal file
|
|
@ -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
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue