forked from LockGit/gochat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·70 lines (64 loc) · 2.04 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
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
#!/usr/bin/env bash
# Author : Lock
# Email: [email protected]
echo 'start...'
CONFIG_ENV=$1
if [ ! -n "${CONFIG_ENV}" ]
then
echo 'Take Me To Your Heart ! Run all environment in a docker container. ^_^'
echo 'example:'
echo ' sh run.sh dev'
echo ' sh run.sh prod'
else
echo "now env is:${CONFIG_ENV}"
if [ "${CONFIG_ENV}" == "dev" ]
then
DOCKER_IMAGE="lockgit/gochat:1.18"
elif [ "${CONFIG_ENV}" == "prod" ]
then
# You can use your own build docker image
DOCKER_IMAGE="lockgit/gochat:1.18"
fi
echo "nice, now set docker image is:${DOCKER_IMAGE}"
# docker run
if [ "${CONFIG_ENV}" == "dev" ]
then
sudo docker run \
--name gochat-${CONFIG_ENV} \
-h gochat-${CONFIG_ENV} \
-e TZ=Asia/Shanghai \
-e RUN_MODE=dev \
-e ETCD_DATA_DIR=/root/default.etcd \
-v `pwd`:/go/src/gochat \
-v `pwd`/docker/${CONFIG_ENV}/supervisord.d:/etc/supervisord.d \
-v `pwd`/docker/${CONFIG_ENV}/supervisord.conf:/etc/supervisord.conf \
-v `pwd`/docker/${CONFIG_ENV}/redis.conf:/root/redis.conf \
-d \
-p 8080:8080 \
-p 7070:7070 \
-p 7000:7000 \
-p 7001:7001 \
-p 7002:7002 \
${DOCKER_IMAGE} \
supervisord -n && docker exec gochat-${CONFIG_ENV} /bin/sh './reload.sh'
else
sudo docker run \
--name gochat-${CONFIG_ENV} \
-h gochat-${CONFIG_ENV} \
-e TZ=Asia/Shanghai \
-e RUN_MODE=prod \
-e ETCD_DATA_DIR=/root/default.etcd \
-v `pwd`:/go/src/gochat \
-v `pwd`/docker/${CONFIG_ENV}/supervisord.d:/etc/supervisord.d \
-v `pwd`/docker/${CONFIG_ENV}/supervisord.conf:/etc/supervisord.conf \
-v `pwd`/docker/${CONFIG_ENV}/redis.conf:/root/redis.conf \
-d \
-p 8080:8080 \
-p 7070:7070 \
-p 7000:7000 \
-p 7001:7001 \
-p 7002:7002 \
${DOCKER_IMAGE} \
supervisord -n && docker exec gochat-${CONFIG_ENV} /bin/sh './reload.sh'
fi
fi