40 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Bash
		
	
	
	
	
	
		
		
			
		
	
	
			40 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Bash
		
	
	
	
	
	
| 
								 | 
							
								#!/bin/bash
							 | 
						||
| 
								 | 
							
								PRJ_NAME=test14aprilflutterapp-db-d
							 | 
						||
| 
								 | 
							
								DOCKER_USER=risadmin_prod
							 | 
						||
| 
								 | 
							
								DOCKER_PASS=$(sv get risadmin_prod dockerPassword)
							 | 
						||
| 
								 | 
							
								DOCKER_URL=157.66.191.31:3000
							 | 
						||
| 
								 | 
							
								REPO_NAME=test14aprilflutterapp
							 | 
						||
| 
								 | 
							
								GITEA_USER=risadmin_prod
							 | 
						||
| 
								 | 
							
								GITEA_PASS=$(sv get risadmin_prod dockerPassword)
							 | 
						||
| 
								 | 
							
								GITEA_EMAIL=ganeshk@dekatc.com
							 | 
						||
| 
								 | 
							
								GIT_BRANCH=main
							 | 
						||
| 
								 | 
							
								DOMAIN=157.66.191.31:3000
							 | 
						||
| 
								 | 
							
								CONT_PORT=3306
							 | 
						||
| 
								 | 
							
								TARGET_PORT=3306
							 | 
						||
| 
								 | 
							
								PATH_DIR=/data/37052_1744604006188/sureops_deploy/test14aprilflutterapp/sureops/test14aprilflutterapp-db-d/deployment
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#**********************
							 | 
						||
| 
								 | 
							
								cd $PATH_DIR
							 | 
						||
| 
								 | 
							
								cp /data/37052_1744604006188/sureops_deploy/test14aprilflutterapp/test14aprilflutterapp-db-d/authsec_mysql/mysql/wf_table/*.sql .
							 | 
						||
| 
								 | 
							
								pwd
							 | 
						||
| 
								 | 
							
								DOCKER_TAG=1.0
							 | 
						||
| 
								 | 
							
								# 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 $GITEA_PASS --build-arg $GITEA_USER .
							 | 
						||
| 
								 | 
							
								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
							 | 
						||
| 
								 | 
							
								docker push $DOCKER_URL/$DOCKER_USER/$PRJ_NAME
							 | 
						||
| 
								 | 
							
								docker push $DOCKER_URL/$DOCKER_USER/$PRJ_NAME:$DOCKER_TAG 
							 | 
						||
| 
								 | 
							
								IMAGE_ID=$(docker images --format "{{.ID}}" $IMAGE_NAME)
							 | 
						||
| 
								 | 
							
								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
							 | 
						||
| 
								 | 
							
								#echo "Image $IMAGE_ID deployed in container $PRJ_NAME"
							 | 
						||
| 
								 | 
							
								curl -X GET "http://157.66.191.31:31170/sureops/suredocker/updaterepo?repoName=$REPO_NAME&packageName=$PRJ_NAME"
							 | 
						||
| 
								 | 
							
								docker volume prune -f 
							 | 
						||
| 
								 | 
							
								docker network prune -f
							 | 
						||
| 
								 | 
							
								docker image prune -f --filter "dangling=true
							 |