-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
122 lines (115 loc) · 2.8 KB
/
docker-compose.yml
File metadata and controls
122 lines (115 loc) · 2.8 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
115
116
117
118
119
120
121
122
services:
# 数据库服务
db:
image: mysql:8.0
restart: unless-stopped
env_file:
- .env
environment:
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
MYSQL_DATABASE: ${DB_NAME:-yflow}
# 注意:MYSQL_USER 和 MYSQL_PASSWORD 仅用于创建普通用户
# root 用户只需要 MYSQL_ROOT_PASSWORD
volumes:
- mysql_data:/var/lib/mysql
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
interval: 10s
timeout: 5s
retries: 5
networks:
- yflow-network
# 后端服务
backend:
build:
context: ./admin-backend
dockerfile: Dockerfile
restart: unless-stopped
depends_on:
db:
condition: service_healthy
env_file:
- .env
environment:
DB_USERNAME: ${DB_USERNAME:-yflow}
DB_PASSWORD: ${DB_PASSWORD}
DB_HOST: db
DB_PORT: 3306
DB_NAME: ${DB_NAME:-yflow}
JWT_SECRET: ${JWT_SECRET}
JWT_EXPIRATION_HOURS: ${JWT_EXPIRATION_HOURS:-24}
JWT_REFRESH_SECRET: ${JWT_REFRESH_SECRET}
JWT_REFRESH_EXPIRATION_HOURS: ${JWT_REFRESH_EXPIRATION_HOURS:-168}
CLI_API_KEY: ${CLI_API_KEY}
ENV: ${ENV:-production}
LIBRE_TRANSLATE_URL: ${LIBRE_TRANSLATE_URL:-http://libretranslate:5000}
networks:
- yflow-network
# 前端服务
frontend:
build:
context: ./admin-frontend
dockerfile: Dockerfile
restart: unless-stopped
depends_on:
- backend
env_file:
- .env
environment:
- VITE_API_URL=${VITE_API_URL:-/api}
networks:
- yflow-network
# Caddy 反向代理服务
caddy:
image: caddy:2-alpine
container_name: yflow-caddy
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- ./deploy/nginx/Caddyfile:/etc/caddy/Caddyfile
- caddy_data:/data
networks:
- yflow-network
depends_on:
- frontend
- backend
# LibreTranslate 机器翻译服务
libretranslate:
image: libretranslate/libretranslate:latest
container_name: yflow-libretranslate
restart: unless-stopped
ports:
- "127.0.0.1:5000:5000"
environment:
- LT_TITLE=YFlow Translation
- LT_DISABLE_RATE_LIMIT=1
- LT_REQUIRE_API_KEY=false
volumes:
- libretranslate-data:/var/lib/LibreTranslate
healthcheck:
test: ["CMD", "curl", "-kf", "http://localhost:5000/languages"]
interval: 30s
timeout: 15s
retries: 10
start_period: 60s
networks:
- yflow-network
# Redis 缓存服务
redis:
image: redis:7-alpine
container_name: yflow-redis
restart: unless-stopped
volumes:
- redis_data:/data
networks:
- yflow-network
networks:
yflow-network:
driver: bridge
volumes:
mysql_data:
libretranslate-data:
redis_data:
caddy_data: