-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
64 lines (64 loc) · 1.71 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
57
58
59
60
61
62
63
64
# 配置参考:
# - https://docs.docker.com/compose/compose-file/
# - https://www.cnblogs.com/davis12/p/14312267.html
services:
# 数据存储服务(MySQL)
unity-mysql:
image: mysql:8.0.36
container_name: unity-mysql
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
command:
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci
networks:
- goblog
ports:
- "3306:3306"
volumes:
- ${ROOT_DIR}/mysql-data:/var/lib/mysql
# 博客 web 服务
goblog-web:
image: goblog:${GOBLOG_IMAGE_TAG}
container_name: goblog-web
# 等待 mysql 就绪再启动 web 服务
depends_on:
- unity-mysql
environment:
LOG_LEVEL: info
REAL_CLIENT_IP_HEADER_KEY: X-Real-IP
GOOGLE_SITE_VERIFICATION_CODE: ${GOOGLE_SITE_VERIFICATION_CODE}
BAIDU_SITE_VERIFICATION_CODE: ${BAIDU_SITE_VERIFICATION_CODE}
MYSQL_HOST: unity-mysql
MYSQL_PORT: "3306"
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
networks:
- goblog
ports:
- "8080:8080"
volumes:
- ${ROOT_DIR}/goblog-logs:/data/logs/
# 反向代理 Nginx
unity-nginx:
image: nginx:1.25.5
container_name: unity-nginx
# 先启动 web 服务再代理
depends_on:
- goblog-web
networks:
- goblog
ports:
- "80:80"
- "443:443"
volumes:
- ${ROOT_DIR}/ssl_cert:/etc/nginx/ssl
- ${ROOT_DIR}/nginx.conf:/etc/nginx/conf.d/default.conf
# 所有容器共享同一网络
networks:
goblog:
driver: bridge