-
Notifications
You must be signed in to change notification settings - Fork 0
/
start_server.sh
45 lines (37 loc) · 1.09 KB
/
start_server.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
#!/usr/bin/env bash
# Run script from its folder
CWD=$PWD
# Define repository location
LOCALREPO=doebase
GITHUB=https://github.com/pablocarb
REPO=$GITHUB/${LOCALREPO}.git
# true for the cloud server, false for local installation
DEPLOY=true
if [ "$USER" == "pablo" ]; then
DEPLOY=false
fi
# Stop an delete doe containers
docker stop doe
docker rm doe
docker rmi doe
# Update repository and change to production branch
if [ ! -d $LOCALREPO ]
then
git clone $REPO $LOCALREPO
else
cd $LOCALREPO
git pull
cd $CWD
fi
# Build new image
docker build -t doe .
# Stop and delete proxy containers in order to register the new app
docker stop nginx-proxy
docker rm nginx-proxy
# Run container
if [ "$DEPLOY" == "true" ]; then
docker run --name nginx-proxy -d -p 80:80 -v /var/run/docker.sock:/tmp/docker.sock:ro jwilder/nginx-proxy
docker run --name doe -d -p 8989:8989 -e LD_LIBRARY_PATH='/opt/conda/bin/../lib' -v $PWD:/appoptdes -e VIRTUAL_HOST=optbiodes.synbiochem.co.uk doe
else
docker run --name doe -p 8989:8989 -e LD_LIBRARY_PATH='/opt/conda/bin/../lib' -v $PWD:/appoptdes doe
fi