forked from brainlife/ezbids
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlaunch.sh
executable file
·66 lines (55 loc) · 1.88 KB
/
launch.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
#!/usr/bin/env bash
# check to see if a .env file exists
if [ -f .env ]; then
echo ".env file exists, loading environment variables from .env file"
else
echo ".env file does not exist, copying example.env to .env"
cp example.env .env
fi
# load the environment variables from the .env file
source .env
echo "Setting Environment Variables from .env file:"
# display the environment variables read in from .env, could be a gotcha if
# the user is unclear about if the .env variables are being used. The .env variables
# will override environment variables set in the shell as they're set once this script
# is run.
while read line
do
# if line does not start with # then echo the line
if [[ $line != \#* ]]; then
if [[ $line != "" ]]; then
echo " ${line}"
fi
fi
done < .env
if [ $BRAINLIFE_DEVELOPMENT == true ]; then
# enable or disable debugging output
set -ex
else
set -e
fi
# build local changes and mount them directly into the containers
# api/ and ui/ are mounted as volumes at /app within the docker-compose.yml
(cd api && npm install)
(cd ui && npm install)
# update the bids submodule
git submodule update --init --recursive
# The main differences between the production and development docker-compose files are that the production
# files uses https via nginx and the development file uses http.
if [[ $BRAINLIFE_PRODUCTION == true ]]; then
DOCKER_COMPOSE_FILE=docker-compose-production.yml
else
DOCKER_COMPOSE_FILE=docker-compose.yml
fi
mkdir -p /tmp/upload
mkdir -p /tmp/workdir
#npm run prepare-husky
./generate_keys.sh
# ok docker compose is now included in docker as an option for docker
if [[ $(command -v docker-compose) ]]; then
# if the older version is installed use the dash
docker-compose --file ${DOCKER_COMPOSE_FILE} up
else
# if the newer version is installed don't use the dash
docker compose --file ${DOCKER_COMPOSE_FILE} up
fi