-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·40 lines (33 loc) · 1.8 KB
/
deploy.sh
File metadata and controls
executable file
·40 lines (33 loc) · 1.8 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
if [ ! "$(docker network ls | grep jamiu)" ];
then
echo "************************************* jamiu Network not Running, Creating one *******************************"
docker network create jamiu
docker network connect jamiu mysql
else
echo "************************************* jamiu Network Running, Moving on *******************************"
fi
echo "************************************* Start the database container if not running *******************************"
if [ ! "$(docker ps -q -f name=mysql)" ];
then
docker start mysql
fi
echo "************************************* Creating Database if not exists *******************************"
docker exec -i mysql mysql -ucreator -pI_only_create! <<< "create database IF NOT EXISTS billermanager;"
if [ ! "$(docker ps -q -f name=billermanager-service)" ]
then
echo "************************************* No instance of billermanager Service Running Container *******************************"
if [ "$(docker ps -aq -f name=billermanager-service)" ]
then
echo "************************************* Removing Previous non-running Container *******************************"
docker rm billermanager-service
fi
else
echo "************************************* Killing Previous Container *******************************"
docker kill billermanager-service
echo "************************************* Removing Previous Container *******************************"
docker rm billermanager-service
fi
echo "************************************* Starting the new Container *******************************"
docker pull jamiu-limited/images:billermanager-service
docker run -d -p 8020:8020 --name billermanager-service --network jamiu jamiu-limited/images:billermanager-service