-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
114 lines (108 loc) · 2.76 KB
/
Copy pathdocker-compose.yml
File metadata and controls
114 lines (108 loc) · 2.76 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
version: '3.8'
services:
# MySQL 数据库
mysql:
image: mysql:8.0
container_name: light-mysql
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: your_root_password_here
MYSQL_DATABASE: db_light
MYSQL_USER: light_user
MYSQL_PASSWORD: your_password_here
TZ: Asia/Shanghai
volumes:
- mysql_data:/var/lib/mysql
- ./doc/db_light.sql:/docker-entrypoint-initdb.d/01-init.sql:ro
- ./doc/database_optimization.sql:/docker-entrypoint-initdb.d/02-optimization.sql:ro
- ./mysql/conf:/etc/mysql/conf.d:ro
ports:
- "3306:3306"
command: --default-authentication-plugin=mysql_native_password
networks:
- light-network
# Redis 缓存
redis:
image: redis:7-alpine
container_name: light-redis
restart: unless-stopped
environment:
TZ: Asia/Shanghai
volumes:
- redis_data:/data
- ./redis/redis.conf:/usr/local/etc/redis/redis.conf:ro
ports:
- "6379:6379"
command: redis-server /usr/local/etc/redis/redis.conf
networks:
- light-network
# Light Admin 后台管理
light-admin:
build:
context: .
dockerfile: Dockerfile
container_name: light-admin
restart: unless-stopped
environment:
SPRING_PROFILES_ACTIVE: docker
TZ: Asia/Shanghai
# 数据库配置
SPRING_DATASOURCE_URL: jdbc:mysql://mysql:3306/db_light?characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8
SPRING_DATASOURCE_USERNAME: light_user
SPRING_DATASOURCE_PASSWORD: your_password_here
# Redis配置
SPRING_DATA_REDIS_HOST: redis
SPRING_DATA_REDIS_PORT: 6379
SPRING_DATA_REDIS_PASSWORD: ""
SPRING_DATA_REDIS_DATABASE: 0
# 日志配置
LOGGING_LEVEL_ROOT: INFO
LOGGING_LEVEL_CN_LIGHT: DEBUG
volumes:
- app_logs:/app/logs
- file_uploads:/app/uploads
ports:
- "2034:2034"
depends_on:
- mysql
- redis
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:2034/actuator/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
networks:
- light-network
# Nginx 反向代理(可选)
nginx:
image: nginx:alpine
container_name: light-nginx
restart: unless-stopped
environment:
TZ: Asia/Shanghai
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./nginx/conf.d:/etc/nginx/conf.d:ro
- nginx_logs:/var/log/nginx
ports:
- "80:80"
- "443:443"
depends_on:
- light-admin
networks:
- light-network
volumes:
mysql_data:
driver: local
redis_data:
driver: local
app_logs:
driver: local
file_uploads:
driver: local
nginx_logs:
driver: local
networks:
light-network:
driver: bridge