-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathdocker-compose-build.yml
145 lines (136 loc) · 3.49 KB
/
docker-compose-build.yml
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
##
# docker-compose.yml
#
# ```
# $ alias dkc=docker-compose
# $ cp .env.default .env
# $ vi .env
# $ dkc config
# ```
#
# @license Apache-2.0
# @maintainer <github.com/farwish>
# @guide: https://docs.docker.com/compose/compose-file/
##
version: '3'
services:
nginx:
image: nginx:${IMG_NGINX_VERSION}
container_name: nginx-con
volumes:
- /etc/localtime:/etc/localtime
- ${DKC_AP}/etc/timezone:/etc/timezone
- ${DKC_AP}/nginx/nginx.conf:/etc/nginx/nginx.conf
- ${DKC_AP}/nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf
- ${DKC_AP}/nginx/cert:/etc/nginx/cert
- ${DKC_AP}/web:${CONTAINER_WEB_AP}
- /var/log/nginx/:/var/log/nginx/
ports:
- 80:80
- 81:81
- 82:82
- 443:443
depends_on:
- php
restart: on-failure
networks:
- default_net
mysql:
build:
context: ./mysql
dockerfile: Dockerfile
args:
MYSQL_VERSION: ${IMG_MYSQL_VERSION}
container_name: mysql-con
environment: # 相当于命令行中的环境变量 docker run -e KEY=VAL
MYSQL_ROOT_PASSWORD: ${_MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: ${_MYSQL_DATABASE}
volumes:
- /etc/localtime:/etc/localtime
- ${DKC_AP}/etc/timezone:/etc/timezone
- /var/lib/docker/volumes/mysql:/var/lib/mysql
- ${DKC_AP}/mysql/mysql.conf.d:/etc/mysql/mysql.conf.d
ports:
- ${HOST_MYSQL_PORT}:3306
restart: on-failure
image: phvia/mysql:${IMG_MYSQL_VERSION} # For tag
networks:
- default_net
redis:
build:
context: ./redis
dockerfile: Dockerfile
args:
REDIS_VERSION: ${IMG_REDIS_VERSION}
container_name: redis-con
volumes:
- /etc/localtime:/etc/localtime
- ${DKC_AP}/etc/timezone:/etc/timezone
- /var/lib/docker/volumes/redis:/data
ports:
- ${HOST_REDIS_PORT}:6379
sysctls:
net.core.somaxconn: 1024
restart: on-failure
image: phvia/redis:${IMG_REDIS_VERSION}
networks:
- default_net
php:
build:
context: ./php-fpm
dockerfile: Dockerfile
args:
PHP_VERSION: ${IMG_PHP_VERSION}
container_name: php-con
volumes:
- /etc/localtime:/etc/localtime
- ${DKC_AP}/etc/timezone:/etc/timezone
- ${DKC_AP}/php-fpm/php.ini:/usr/local/etc/php/php.ini
- ${DKC_AP}/php-fpm/php-fpm.d/www.conf:/usr/local/etc/php-fpm.d/www.conf
- ${DKC_AP}/web:${CONTAINER_WEB_AP}
ports:
- ${HOST_PHP_PORT}:9000
depends_on:
- mysql
restart: on-failure
image: phvia/php-fpm:${IMG_PHP_VERSION}
networks:
- default_net
web:
build:
context: ./web
dockerfile: Dockerfile
args:
PHP_VERSION: ${IMG_PHP_VERSION}
WEB_PATH: ${CONTAINER_WEB_AP}
container_name: web-con
volumes:
- /etc/localtime:/etc/localtime
- ${DKC_AP}/etc/timezone:/etc/timezone
- ${DKC_AP}/web:${CONTAINER_WEB_AP}
depends_on:
- php
restart: on-failure
image: phvia/web:${IMG_PHP_VERSION}
networks:
- default_net
fe:
build:
context: ./web
dockerfile: Dockerfile-fe
args:
PHP_VERSION: ${IMG_PHP_VERSION}
WEB_PATH: ${CONTAINER_WEB_AP}
container_name: fe-con
volumes:
- /etc/localtime:/etc/localtime
- ${DKC_AP}/etc/timezone:/etc/timezone
- ${DKC_AP}/web:${CONTAINER_WEB_AP}
depends_on:
- php
image: phvia/fe:10.x
networks:
- default_net
networks:
default_net:
driver: bridge