feat(alerts): changed build script

feat(crons): changed build script
feat(alerts): changed build script
This commit is contained in:
Taha Yassine Kraiem 2022-11-14 16:02:18 +01:00
parent c780bcee14
commit 09d376da08
12 changed files with 28 additions and 16 deletions

View file

@ -19,8 +19,12 @@ check_prereq() {
} }
function build_api(){ function build_api(){
cp -R ../api ../_api destination="_api"
cd ../_api [[ $1 == "ee" ]] && {
destination="_api_ee"
}
cp -R ../api ../${destination}
cd ../${destination}
tag="" tag=""
# Copy enterprise code # Copy enterprise code
[[ $1 == "ee" ]] && { [[ $1 == "ee" ]] && {
@ -28,9 +32,10 @@ function build_api(){
envarg="default-ee" envarg="default-ee"
tag="ee-" tag="ee-"
} }
mv Dockerfile.dockerignore .dockerignore
docker build -f ./Dockerfile --build-arg envarg=$envarg -t ${DOCKER_REPO:-'local'}/chalice:${git_sha1} . docker build -f ./Dockerfile --build-arg envarg=$envarg -t ${DOCKER_REPO:-'local'}/chalice:${git_sha1} .
cd ../api cd ../api
rm -rf ../_api rm -rf ../${destination}
[[ $PUSH_IMAGE -eq 1 ]] && { [[ $PUSH_IMAGE -eq 1 ]] && {
docker push ${DOCKER_REPO:-'local'}/chalice:${git_sha1} docker push ${DOCKER_REPO:-'local'}/chalice:${git_sha1}
docker tag ${DOCKER_REPO:-'local'}/chalice:${git_sha1} ${DOCKER_REPO:-'local'}/chalice:${tag}latest docker tag ${DOCKER_REPO:-'local'}/chalice:${git_sha1} ${DOCKER_REPO:-'local'}/chalice:${tag}latest
@ -47,4 +52,5 @@ IMAGE_TAG=$IMAGE_TAG PUSH_IMAGE=$PUSH_IMAGE DOCKER_REPO=$DOCKER_REPO bash build_
[[ $1 == "ee" ]] && { [[ $1 == "ee" ]] && {
cp ../ee/api/build_crons.sh . cp ../ee/api/build_crons.sh .
IMAGE_TAG=$IMAGE_TAG PUSH_IMAGE=$PUSH_IMAGE DOCKER_REPO=$DOCKER_REPO bash build_crons.sh $1 IMAGE_TAG=$IMAGE_TAG PUSH_IMAGE=$PUSH_IMAGE DOCKER_REPO=$DOCKER_REPO bash build_crons.sh $1
rm build_crons.sh
} }

View file

@ -16,9 +16,13 @@ check_prereq() {
} }
} }
function build_api(){ function build_alerts(){
cp -R ../api ../_alerts destination="_alerts"
cd ../_alerts [[ $1 == "ee" ]] && {
destination="_alerts_ee"
}
cp -R ../api ../${destination}
cd ../${destination}
tag="" tag=""
# Copy enterprise code # Copy enterprise code
[[ $1 == "ee" ]] && { [[ $1 == "ee" ]] && {
@ -26,9 +30,10 @@ function build_api(){
envarg="default-ee" envarg="default-ee"
tag="ee-" tag="ee-"
} }
docker build -f ./Dockerfile.alerts --build-arg envarg=$envarg -t ${DOCKER_REPO:-'local'}/alerts:${git_sha1} . mv Dockerfile_alerts.dockerignore .dockerignore
docker build -f ./Dockerfile_alerts --build-arg envarg=$envarg -t ${DOCKER_REPO:-'local'}/alerts:${git_sha1} .
cd ../api cd ../api
rm -rf ../_alerts rm -rf ../${destination}
[[ $PUSH_IMAGE -eq 1 ]] && { [[ $PUSH_IMAGE -eq 1 ]] && {
docker push ${DOCKER_REPO:-'local'}/alerts:${git_sha1} docker push ${DOCKER_REPO:-'local'}/alerts:${git_sha1}
docker tag ${DOCKER_REPO:-'local'}/alerts:${git_sha1} ${DOCKER_REPO:-'local'}/alerts:${tag}latest docker tag ${DOCKER_REPO:-'local'}/alerts:${git_sha1} ${DOCKER_REPO:-'local'}/alerts:${tag}latest
@ -38,4 +43,4 @@ function build_api(){
} }
check_prereq check_prereq
build_api $1 build_alerts $1

View file

@ -17,19 +17,20 @@ check_prereq() {
[[ exit -eq 1 ]] && exit 1 [[ exit -eq 1 ]] && exit 1
} }
function build_api(){ function build_crons(){
cp -R ../api ../_crons destination="_crons_ee"
cd ../_crons cp -R ../api ../${destination}
cd ../${destination}
tag="" tag=""
# Copy enterprise code # Copy enterprise code
cp -rf ../ee/api/* ./ cp -rf ../ee/api/* ./
envarg="default-ee" envarg="default-ee"
tag="ee-" tag="ee-"
mv Dockerfile_crons.dockerignore .dockerignore
docker build -f ./Dockerfile.crons --build-arg envarg=$envarg -t ${DOCKER_REPO:-'local'}/crons:${git_sha1} . docker build -f ./Dockerfile_crons --build-arg envarg=$envarg -t ${DOCKER_REPO:-'local'}/crons:${git_sha1} .
cd ../api cd ../api
rm -rf ../_crons rm -rf ../${destination}
[[ $PUSH_IMAGE -eq 1 ]] && { [[ $PUSH_IMAGE -eq 1 ]] && {
docker push ${DOCKER_REPO:-'local'}/crons:${git_sha1} docker push ${DOCKER_REPO:-'local'}/crons:${git_sha1}
docker tag ${DOCKER_REPO:-'local'}/crons:${git_sha1} ${DOCKER_REPO:-'local'}/crons:${tag}latest docker tag ${DOCKER_REPO:-'local'}/crons:${git_sha1} ${DOCKER_REPO:-'local'}/crons:${tag}latest
@ -39,4 +40,4 @@ function build_api(){
} }
check_prereq check_prereq
build_api $1 build_crons $1