-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrun.sh
executable file
·43 lines (32 loc) · 1.07 KB
/
run.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
#!/usr/bin/env bash
# Make bash exit if a command fails
set -e
if [ "$#" -lt 1 ]; then
echo "Usage: $0 [prod|dev] <docker compose args>"
echo "Start anemolab service using existing docker images."
echo "Example:"
echo " $0 dev up"
exit 1
fi
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
ENVIRONMENT=$1
shift
if ! [ -f .jwt_secret ] ; then
openssl rand -base64 18 > .jwt_secret
fi
export JWT_SECRET=$(cat .jwt_secret)
if [ ${ENVIRONMENT} == "prod" ]; then
echo "Starting in prod mode. Changes in the www2 folder will be ignored."
echo "http://localhost:9000/ will come up soon."
docker-compose -f "${DIR}/docker-compose.yml" $*
elif [ ${ENVIRONMENT=} == "dev" ]; then
echo "Starting in dev mode. Will live-reload any changes in the www2 folder."
echo "http://localhost:9001/ will come up soon."
FILE="docker-compose-dev.yml"
PORT=9001
mkdir -p /tmp/home
USER_ID=$(id -u):$(id -g) docker compose -f "${DIR}/${FILE}" ${*:-up}
else
echo "Invalid option for run.sh please provide either 'prod' or 'dev'"
exit 1
fi