-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
61 lines (55 loc) · 1.9 KB
/
Copy pathdocker-compose.yml
File metadata and controls
61 lines (55 loc) · 1.9 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
version: "3"
volumes: # 自定义数据卷
LabManager_db_vol: # 定义数据卷同步容器内mysql数据
LabManager_redis_vol: # 定义数据卷同步redis容器内数据
LabManager_media_vol: # 定义数据卷同步media文件夹数据
services:
db:
image: mysql:5.7
environment:
- MYSQL_ROOT_PASSWORD=eminem # 数据库密码
- MYSQL_DATABASE=lab_test # 数据库名称
- MYSQL_USER=catas # 数据库用户名
- MYSQL_PASSWORD=eminem # 用户密码
volumes:
- LabManager_db_vol:/var/lib/mysql:rw # 挂载数据库数据, 可读可写
- ./LabM_compose/mysql/conf/my.cnf:/etc/mysql/my.cnf # 挂载配置文件
- ./LabM_compose/mysql/init:/docker-entrypoint-initdb.d/ # 挂载数据初始化sql脚本
ports:
- "3306:3306" # 与配置文件保持一致
restart: always
web:
build: . # 使用目录下的Dockerfile
expose:
- "8000"
volumes:
- .:/var/LabManager # 挂载项目代码
- LabManager_media_vol:/var/LabManager/media # 以数据卷挂载容器内用户上传媒体文件
- ./LabM_compose/uwsgi:/tmp # 挂载uwsgi日志
links:
- db
depends_on: # 依赖关系
- db
environment:
- DEBUG=False
restart: always
tty: true
stdin_open: true
nginx:
build: ./LabM_compose/nginx
ports:
- "80:80"
- "443:443"
- "8080:8080"
expose:
- "80"
volumes:
- ./static:/usr/share/nginx/html/static # 挂载静态文件
- ./LabM_compose/nginx/ssl:/usr/share/nginx/ssl # 挂载ssl证书目录
- ./LabM_compose/nginx/log:/var/log/nginx # 挂载日志
- LabManager_media_vol:/usr/share/nginx/html/media # 挂载用户上传媒体文件
links:
- web
depends_on:
- web
restart: always