-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathdocker-compose.yml
56 lines (56 loc) · 1.39 KB
/
docker-compose.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
version: '3.4'
services:
nginx:
build: ./nginx
image: nginx:volume-fixed-latest
# 端口映射
ports:
- "$NGINX_PORT:80"
# 依赖关系 先跑php
depends_on:
- "php-fpm"
# 数据卷
volumes:
- "$PWD/xiuno:/var/www/html"
networks:
- xiuno_net
links:
- php-fpm
- mysql
# 容器名称
container_name: "xiuno-nginx"
php-fpm:
build: ./php-fpm
# image指定build Dockerfile生成镜像的名称
image: php:fpm-mysqli-latest
expose:
- "9000"
volumes:
- "$PWD/xiuno:/var/www/html"
networks:
- xiuno_net
container_name: "xiuno-php-fpm"
mysql:
build: ./mysql
image: mysql:fixed-auth-latest
expose:
- "3306"
# 环境变量
environment:
# mysql密码
- MYSQL_ROOT_PASSWORD
- MYSQL_USER
- MYSQL_PASSWORD
volumes:
- "$PWD/mysql/data:/var/lib/mysql"
networks:
xiuno_net:
ipv4_address: $MYSQL_SERVER_ADDRESS
container_name: "xiuno-mysql"
networks:
# 配置docker network
xiuno_net:
driver: bridge
ipam:
config:
- subnet: $DOCKER_NET