forked from openhie/instant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
executable file
·73 lines (60 loc) · 1.46 KB
/
deploy.sh
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-c=*|--custom-package=*)
CUSTOM_PACKAGES+=("${1#*=}")
shift # past argument=value
;;
init|destroy|down|up|test)
ACTION=$1
shift # past value
;;
-*)
OTHER_FLAGS+=("${key} ${2}")
shift # past argument value
shift # past argument value
;;
*)
PACKAGES+=($1)
shift # past value
;;
esac
done
printf "\nCommand Summary\n---------------\n"
echo "> Custom Package Locations: ${CUSTOM_PACKAGES[@]}"
echo "> Action: ${ACTION}"
echo "> Packages: ${PACKAGES[@]}"
echo "> Other Flags: ${OTHER_FLAGS[@]}"
echo
if [[ $ACTION = "init" ]]
then
echo "Delete a pre-existing instant volume..."
docker volume rm instant
fi
echo "Creating fresh instant container with volumes..."
docker create -it --rm\
--mount='type=volume,src=instant,dst=/instant' \
-v /var/run/docker.sock:/var/run/docker.sock \
-v ~/.kube/config:/root/.kube/config:ro \
-v ~/.minikube:/home/$USER/.minikube:ro \
--network host \
--name instant-openhie \
openhie/instant:latest \
$ACTION \
${OTHER_FLAGS[@]} \
${PACKAGES[@]}
echo "Adding 3rd party packages to instant volume:"
for customPackage in "${CUSTOM_PACKAGES[@]}"
do
echo "- ${customPackage}"
docker cp $customPackage instant-openhie:instant/
done
echo "Run Instant OpenHIE Installer Container"
docker start -a instant-openhie
if [[ $ACTION = "destroy" ]]
then
echo "Delete instant volume..."
docker volume rm instant
fi