forked from mangalam-research/wed
-
Notifications
You must be signed in to change notification settings - Fork 1
/
DoComUtil
executable file
·54 lines (49 loc) · 1.11 KB
/
DoComUtil
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
#!/bin/bash
MODE="$2"
case "${MODE}" in
"prod")
DOCKER_FILE=docker-compose-production.yml
;;
*)
DOCKER_FILE=docker-compose-development.yml
;;
esac
echo "docker-compose to use => ${DOCKER_FILE}"
ACTION="$1"
case "${ACTION}" in
"start")
docker-compose -f "${DOCKER_FILE}" up -d
;;
"stop")
docker-compose -f "${DOCKER_FILE}" stop
;;
"remove")
docker-compose -f "${DOCKER_FILE}" down -v
;;
"build")
if [ "${DOCKER_FILE}" == "docker-compose-production.yml" ];
then
docker build -f Dockerfile.production -t wed-ds:latest .
fi
docker-compose -f "${DOCKER_FILE}" build
;;
"access")
if [ "${DOCKER_FILE}" == "docker-compose-production.yml" ];
then
docker exec -it wed-production-server /bin/bash
else
docker exec -it --user node wed-development-server /bin/bash
fi
;;
"deploy")
if [ "${DOCKER_FILE}" == "docker-compose-production.yml" ];
then
echo "ERROR: You can't deploy on production mode, its already deployed!"
else
docker exec --user user wed-development-server /bin/bash -c "buildAndDeployWed"
fi
;;
*)
docker-compose -f $DOCKER_FILE up -d
;;
esac