519
|
1 #!/bin/bash
|
|
2 #
|
|
3 # read required env variables
|
|
4 BASEDIR="$PWD"
|
|
5 source $BASEDIR/.env/ess-shared.properties
|
|
6 source $BASEDIR/.env/ess-db.properties
|
|
7 #
|
|
8 # docker login
|
|
9 echo "attempting to login to $artifactoryUrl"
|
|
10 docker login $artifactoryUrl -u $artifactoryUser -p $artifactoryPassword
|
|
11 # docker pull db image
|
|
12 echo "attempting to pull $artifactoryUrl/ess-db:$dbVersion"
|
|
13 docker pull $artifactoryUrl/ess-db:$dbVersion
|
|
14 #
|
|
15 # create employee self service specific docker network for $entityId
|
|
16 echo "attempting to create $entityId-ess-net docker network"
|
|
17 docker network create $entityId-ess-net
|
|
18 # docker run ess-db (data mounted as volume) connected to $entityId-ess-net docker network
|
|
19 echo "attempting to execute docker run command"
|
|
20 docker run --name $entityId-ess-db \
|
|
21 --restart=unless-stopped \
|
|
22 --mount source=$entityId-ess-db,target=/var/lib/postgresql/data \
|
|
23 --network $entityId-ess-net \
|
|
24 -e POSTGRES_DB=essdb \
|
|
25 -e POSTGRES_PASSWORD=$dbPassword \
|
|
26 -d $artifactUrl/ess-db:$dbVersion |