-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
38 lines (38 loc) · 1.3 KB
/
docker-compose.yml
File metadata and controls
38 lines (38 loc) · 1.3 KB
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
version: '3'
services:
php-workspace:
# image: php:7.3-fpm-alpine
build: ./php # 这里php指我们的创建的目录
volumes: # 这里指定数据卷,可以指定多个, 中划线代表值为数组的一个成员
- ./code:/var/www/html
depends_on:
- db
- redis
nginx:
# image: nginx:alpine
build: ./nginx # 这里nginx指我们的创建的目录
volumes: # 把 nginx 请求日志落地到宿主机
- ./log/nginx:/var/log/nginx
ports:
- "8080:8080"
depends_on:
- php-workspace
db:
image: mysql
ports:
- "3306:3306"
volumes:
- ./mysql/data:/var/lib/mysql
- ./mysql/config:/etc/mysql/conf.d
- ./mysql/log:/var/log/mysql
command:
--default-authentication-plugin=mysql_native_password
--lower_case_table_names=1
--character-set-server=utf8mb4
--collation-server=utf8mb4_unicode_ci
restart: always
environment: # 设定环境变量,只给定名称的变量会自动获取运行 Compose 主机上对应变量的值
MYSQL_ROOT_PASSWORD: 123456
TZ: Asia/Shanghai
redis:
image: redis:5.0.5-alpine