prod29aug/sureops/prod29aug-frant-f/deployment/build.sh

36 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
PRJ_NAME=prod29aug-frant-f
DOCKER_USER=risadmin_prod
DOCKER_PASS=$(sv get risadmin_prod dockerPassword)
DOCKER_URL=git.io8.dev
#********************
REPO_NAME=prod29aug
GITEA_USER=risadmin_prod
GITEA_PASS=$(sv get risadmin_prod dockerPassword)
GITEA_EMAIL=ganeshk@dekatc.com
GIT_BRANCH=main
DOMAIN=git.io8.dev
#WEB-URL-PORT
CONT_PORT=30167
TARGET_PORT=80
PATH_DIR=/data/19705_1724901463962/sureops_deploy/prod29aug/sureops/prod29aug-frant-f/deployment
**********************
cd $PATH_DIR
DOCKER_TAG=1.0
docker system prune -f
# Stop any existing containers with the same name and ports
docker stop $PRJ_NAME >/dev/null 2>&1 || true
docker rm $PRJ_NAME >/dev/null 2>&1 || true
# Build and push the Docker image
DOCKER_BUILDKIT=0 docker build -t $DOCKER_URL/$DOCKER_USER/$PRJ_NAME:$DOCKER_TAG --build-arg BUILD_ID=$DOCKER_TAG --build-arg $GITEA_USER --build-arg $GITEA_PASS .
docker login --username=$DOCKER_USER --password=$DOCKER_PASS $DOCKER_URL
docker tag $DOCKER_URL/$DOCKER_USER/$PRJ_NAME:$DOCKER_TAG $DOCKER_URL/$DOCKER_USER/$PRJ_NAME:latest
docker push $DOCKER_URL/$DOCKER_USER/$PRJ_NAME:latest
docker push $DOCKER_URL/$DOCKER_USER/$PRJ_NAME:$DOCKER_TAG
docker logout $DOCKER_URL
docker system prune -f
# Deploy the image in a Docker container
#docker run -d --name $PRJ_NAME -p $CONT_PORT:$TARGET_PORT $DOCKER_USER/$PRJ_NAME:$DOCKER_TAG
curl -X GET "http://13.200.171.124:31123/sureops/suredocker/updaterepo?repoName=$REPO_NAME&packageName=$PRJ_NAME"
#echo "Image deployed in container $PRJ_NAME"