dynamic branch and image details for release script

This commit is contained in:
Vikas Nale 2025-09-19 13:10:37 +05:30
parent 6bbb9f5944
commit d7eb0a8705
5 changed files with 35 additions and 13 deletions

View File

@ -1,9 +1,17 @@
# config.env # config.env
ENVIRONMENT=production ENVIRONMENT=production
WEB_BRANCH_NAME=Issue_May_2W WEB_BRANCH_NAME=react-query-v2
WEB_IMAGE_NAME=marco.web.prod:v1.1 WEB_IMAGE_NAME=marco.web.prod:v3.13
WEB_CONTAINER_NAME=marco.web.prod WEB_CONTAINER_NAME=marco.web.prod
API_BRANCH_NAME=Issues_May_2W WEB_PORT=4175
API_IMAGE_NAME=marco.api.prod:v1.1 WEB_REPO_DIR=marco.pms.web
WEB_REPO=https://git.marcoaiot.com/admin/marco.pms.web.git
API_BRANCH_NAME=Ashutosh_Refactor
API_IMAGE_NAME=marco.api.prod:v3.13.1
API_CONTAINER_NAME=marco.api.prod API_CONTAINER_NAME=marco.api.prod
API_PORT1=8085
API_PORT2=8086
API_REPO_DIR=marco.pms.api
API_REPO=https://git.marcoaiot.com/admin/marco.pms.api.git
API_URL=https://api.marcoaiot.com API_URL=https://api.marcoaiot.com

View File

@ -6,7 +6,7 @@ source ./config.env
# Step 1: set branch Name # Step 1: set branch Name
IMAGE_NAME=$API_IMAGE_NAME IMAGE_NAME=$API_IMAGE_NAME
CONTAINER_NAME=$API_CONTAINER_NAME CONTAINER_NAME=$API_CONTAINER_NAME
REPO_DIR="marco.pms.api" REPO_DIR=$API_REPO_DIR
# Navigate into the project directory # Navigate into the project directory
@ -46,7 +46,7 @@ fi
# Step 5: Run the Docker containerer # Step 5: Run the Docker containerer
echo "Running Docker container..." echo "Running Docker container..."
docker run -d --name $CONTAINER_NAME --network mynetwork -p 8085:8080 -p 8086:8081 $IMAGE_NAME docker run -d --name $CONTAINER_NAME --network mynetwork -p $API_PORT1:8080 -p $API_PORT2:8081 $IMAGE_NAME
# Step 6: Final Message # Step 6: Final Message
echo "Successfully Running $CONTAINER_NAME" echo "Successfully Running $CONTAINER_NAME"

View File

@ -7,7 +7,7 @@ source ./config.env
# Set the name for the Docker image and container # Set the name for the Docker image and container
IMAGE_NAME=$WEB_IMAGE_NAME IMAGE_NAME=$WEB_IMAGE_NAME
CONTAINER_NAME=$WEB_CONTAINER_NAME CONTAINER_NAME=$WEB_CONTAINER_NAME
REPO_DIR="marco.pms.web" REPO_DIR=$WEB_REPO_DIR
VITE_API_URL=$API_URL VITE_API_URL=$API_URL
@ -68,7 +68,7 @@ cd ../
# Step 7: Run the Docker containerer # Step 7: Run the Docker containerer
echo "------------ Running Docker container..." echo "------------ Running Docker container..."
docker run -d --name "$CONTAINER_NAME" -p 4175:4173 \ docker run -d --name "$CONTAINER_NAME" -p $WEB_PORT:4173 \
-e VITE_API_URL="$VITE_API_URL" "$IMAGE_NAME" -e VITE_API_URL="$VITE_API_URL" "$IMAGE_NAME"

View File

@ -3,12 +3,13 @@
# Load config file # Load config file
source ./config.env source ./config.env
# Repository URL
REPO_URL=$API_REPO
REPO_DIR=$API_REPO_DIR
#set branch Name #set branch Name
BRANCH_NAME=$API_BRANCH_NAME BRANCH_NAME=$API_BRANCH_NAME
# Repository URL
REPO_URL="https://git.marcoaiot.com/admin/marco.pms.api.git"
REPO_DIR="marco.pms.api"
# Step 1: Clone the GitHub repository (use the branch defined) # Step 1: Clone the GitHub repository (use the branch defined)
if [ -d "$REPO_DIR" ]; then if [ -d "$REPO_DIR" ]; then
@ -27,4 +28,17 @@ else
fi fi
echo "Successfully pull $BRANCH_NAME" echo "Successfully pull $BRANCH_NAME"
echo "---------------------------------------------"
echo "Copying appsetting"
cd ..
SOURCE_FILE="./appsettings.Production.json"
TARGET_DIR="./marco.pms.api/Marco.Pms.Services/"
cp "$SOURCE_FILE" "$TARGET_DIR"
#cp "./appsettings.Production.json" "./marco.pms.api/Marco.Pms.Services/"
echo "Successfully copied appsetting to $TARGET_DIR"

View File

@ -8,8 +8,8 @@ source ./config.env
BRANCH_NAME=$WEB_BRANCH_NAME BRANCH_NAME=$WEB_BRANCH_NAME
# Repository URL # Repository URL
REPO_URL="https://git.marcoaiot.com/admin/marco.pms.web.git" REPO_URL=$WEB_REPO
REPO_DIR="marco.pms.web" REPO_DIR=$WEB_REPO_DIR
# Step 1: Clone the GitHub repository (use the branch defined) # Step 1: Clone the GitHub repository (use the branch defined)
if [ -d "$REPO_DIR" ]; then if [ -d "$REPO_DIR" ]; then