forked from I-TECH-UW/openelis-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·90 lines (73 loc) · 3.58 KB
/
build.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/bash
projectVersion=${1:-"latest"}
dockerVersion=${2:-"develop"}
INSTALLER_CREATION_DIR="OEDockerInstaller"
CALL_DIR=$PWD
cd ${CALL_DIR}
if [ -d "${INSTALLER_CREATION_DIR}" ]
then
while true; do
read -p "Installer directory has been detected, replace it? [Y]es [N]o: " yn
case $yn in
[Yy][Ee][Ss]|[Yy] ) break;;
[Nn][Oo]|[Nn] ) exit;;
* ) echo "Please answer yes or no.";;
esac
done
rm -r ${INSTALLER_CREATION_DIR}
fi
echo "creating docker images"
createLinuxInstaller() {
context="OpenELIS-Global"
installerName="${context}_${projectVersion}_docker_installer"
echo "creating installer for context ${context}"
mkdir -p ${INSTALLER_CREATION_DIR}/${installerName}/dockerImage
mkdir -p ${INSTALLER_CREATION_DIR}/${installerName}/volumes
cp ./install/run.sh ${INSTALLER_CREATION_DIR}/${installerName}/run.sh
cp ./install/upgrade.sh ${INSTALLER_CREATION_DIR}/${installerName}/upgrade.sh
cp docker-compose.yml ${INSTALLER_CREATION_DIR}/${installerName}/docker-compose.yml
cp -r volumes/* ${INSTALLER_CREATION_DIR}/${installerName}/volumes
cp OpenELIS-Global_DockerImage.tar.gz ${INSTALLER_CREATION_DIR}/${installerName}/dockerImage/OpenELIS-Global_DockerImage.tar.gz
cp Postgres_DockerImage.tar.gz ${INSTALLER_CREATION_DIR}/${installerName}/dockerImage/Postgres_DockerImage.tar.gz
cp JPAServer_DockerImage.tar.gz ${INSTALLER_CREATION_DIR}/${installerName}/dockerImage/JPAServer_DockerImage.tar.gz
cp AutoHeal_DockerImage.tar.gz ${INSTALLER_CREATION_DIR}/${installerName}/dockerImage/AutoHeal_DockerImage.tar.gz
cp NGINX_DockerImage.tar.gz ${INSTALLER_CREATION_DIR}/${installerName}/dockerImage/NGINX_DockerImage.tar.gz
cp ReactFrontend_DockerImage.tar.gz ${INSTALLER_CREATION_DIR}/${installerName}/dockerImage/ReactFrontend_DockerImage.tar.gz
cp Certs_DockerImage.tar.gz ${INSTALLER_CREATION_DIR}/${installerName}/dockerImage/Certs_DockerImage.tar.gz
cd ${INSTALLER_CREATION_DIR}
tar -cf ${installerName}.tar ${installerName}
gzip ${installerName}.tar
rm -r ${installerName}
cd ${CALL_DIR}
}
cd ${CALL_DIR}
echo "saving docker image as OpenELIS-Global_DockerImage.tar.gz"
docker pull itechuw/openelis-global-2:${dockerVersion}
docker save itechuw/openelis-global-2:${dockerVersion} | gzip > OpenELIS-Global_DockerImage.tar.gz
echo "saving React frontend docker image"
docker pull itechuw/openelis-global-2-frontend:${dockerVersion}
docker save itechuw/openelis-global-2-frontend:${dockerVersion} | gzip > ReactFrontend_DockerImage.tar.gz
echo "saving JPA Server docker image"
docker pull itechuw/openelis-global-2-fhir:${dockerVersion}
docker save itechuw/openelis-global-2-fhir:${dockerVersion} | gzip > JPAServer_DockerImage.tar.gz
echo "saving Postgres docker image"
docker pull postgres:14.4
docker save postgres:14.4 | gzip > Postgres_DockerImage.tar.gz
echo "saving Autoheal docker image"
docker pull willfarrell/autoheal:1.2.0
docker save willfarrell/autoheal:1.2.0 | gzip > AutoHeal_DockerImage.tar.gz
echo "saving NGINX docker image"
docker pull itechuw/openelis-global-2-proxy:${dockerVersion}
docker save itechuw/openelis-global-2-proxy:${dockerVersion} | gzip > NGINX_DockerImage.tar.gz
echo "saving Certs docker image"
docker pull itechuw/certgen:main
docker save itechuw/certgen:main | gzip > Certs_DockerImage.tar.gz
cd ${CALL_DIR}
createLinuxInstaller
rm OpenELIS-Global_DockerImage*.tar.gz
rm Postgres_DockerImage.tar.gz
rm JPAServer_DockerImage.tar.gz
rm AutoHeal_DockerImage.tar.gz
rm NGINX_DockerImage.tar.gz
rm ReactFrontend_DockerImage.tar.gz
rm Certs_DockerImage.tar.gz