-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
25 lines (23 loc) · 1.07 KB
/
deploy.sh
File metadata and controls
25 lines (23 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash
# Docker Hub username
docker login -u cjayanth -p dckr_pat_b7SY8aUaMHV1wGURqY4jQoukKNI
DOCKER_USERNAME="cjayanth"
# Check the argument passed
if [[ "$1" == "devchanged" ]]; then
echo "Tagging and pushing image to dev repository..."
IMAGE_COUNT="$2" # Use the count passed as an argument
docker tag "react:${IMAGE_COUNT}" "${DOCKER_USERNAME}/dev:Latest${IMAGE_COUNT}"
docker push "${DOCKER_USERNAME}/dev:Latest${IMAGE_COUNT}"
export IMAGE_NAME="react:${IMAGE_COUNT}" # Export before running docker-compose
docker compose up -d
elif [[ "$1" == "devmergedmaster" ]]; then
echo "Tagging and pushing image to prod repository..."
IMAGE_COUNT="$2" # Use the count passed as an argument
docker tag "react:${IMAGE_COUNT}" "${DOCKER_USERNAME}/prod:Latest${IMAGE_COUNT}"
docker push "${DOCKER_USERNAME}/prod:Latest${IMAGE_COUNT}"
export IMAGE_NAME="react:${IMAGE_COUNT}" # Export before running docker-compose
docker compose up -d
else
echo "Invalid argument. Please provide either 'devchanged' or 'devmergedmaster'."
exit 1
fi