-
Notifications
You must be signed in to change notification settings - Fork 26
/
docker-compose.yml
43 lines (40 loc) · 1.1 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
version: '3'
services:
db:
image: "mysql:5.7"
# 5.7内存占用小,如果要性能更高可以使用mysql最新版
container_name: movie_mysql
command:
[
'--character-set-server=utf8mb4', #设置utf8编码
'--collation-server=utf8mb4_unicode_ci'
]
volumes:
- mysql_data:/var/lib/mysql
restart: always
environment:
TZ: Asia/Shanghai
MYSQL_ROOT_PASSWORD: 123456 # 数据库root密码
MYSQL_DATABASE: movie # 初始化的数据库名
healthcheck:
test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
timeout: 20s
retries: 10
movie:
depends_on:
db:
condition: service_healthy
image: "yunyizhiying/movie"
container_name: movie
ports:
- "8000:8000"
restart: always
environment:
TZ: Asia/Shanghai
MYSQL_HOST: db:3306 # mysql地址
MYSQL_USER: root # mysql用户名
MYSQL_PASSWORD: 123456 # mysql密码
DATABASE_NAME: movie # mysql数据库
LISTEN_ADDR: :8000 # 主程序监听地址,与ports后面端口保持一致
volumes:
mysql_data: