-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh.example
executable file
·54 lines (44 loc) · 1.21 KB
/
run.sh.example
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
#
# 运行:
# cp ./run.sh.example ./run.sh
# sudo ./run.sh
#
# 注意:需要先从镜像 ibbd/php-fpm 启动容器 ibbd-php-fpm
#
#-----------------------------------
# ----- 配置目录 BEGIN ------------
#-----------------------------------
# 代码目录
code_path=/var/www
# nginx配置目录
conf_path=/etc/nginx/nginx-conf-v2/products
sites_path=$conf_path/sites-enabled
nginx_conf_path=$conf_path/nginx.conf
# nginx日志目录
logs_path=/var/log/nginx
#-----------------------------------
# ----- 配置目录 END --------------
#-----------------------------------
name=nginx
#current_path=$(pwd)
#if [ ! -f $current_path/conf/nginx.conf ]
if [ ! -f $nginx_conf_path ]
then
echo "ERROR: $nginx_conf_path is error."
exit 1
fi
docker stop ibbd-$name
docker rm ibbd-$name
# 注意:这里需要 volumes-from ,否则出错, 因为nginx需要用到相应的路径
docker run --name=ibbd-$name -d \
-p 80:80 \
-p 443:443 \
--link ibbd-php-fpm:php-fpm \
-v $code_path:/var/www \
-v $logs_path:/var/log/nginx \
-v $sites_path:/etc/nginx/sites-enabled:ro \
-v $nginx_conf_path:/etc/nginx/nginx.conf:ro \
--volumes-from ibbd-php-fpm \
ibbd/$name
docker ps