-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.full.yml
More file actions
107 lines (99 loc) · 2.87 KB
/
docker-compose.full.yml
File metadata and controls
107 lines (99 loc) · 2.87 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
version: '3.9'
# Full-stack docker-compose for Leverage OJ
# Includes: Nginx (reverse proxy) + Frontend builder + Backend API + MariaDB + Redis
#
# Usage:
# docker-compose -f docker-compose.full.yml up -d
# Visit: http://localhost
services:
nginx:
image: nginx:alpine
ports:
- "80:80"
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
- frontend_dist:/usr/share/nginx/html:ro
depends_on:
- app
- frontend-builder
restart: unless-stopped
frontend-builder:
image: node:22-alpine
working_dir: /app
volumes:
- ../leverage-frontend-neo:/app
- frontend_dist:/app/.output/public
command: sh -c "npm install -g pnpm && pnpm install && pnpm build"
environment:
NUXT_PUBLIC_API_BASE: /api
app:
build: .
expose:
- "3000"
env_file: .env
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
stop_signal: SIGTERM
stop_grace_period: 30s # give NestJS time to drain active jobs
restart: unless-stopped
db:
image: mariadb:10.11
environment:
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD:-rootpass}
MYSQL_DATABASE: ${DB_DATABASE:-leverage}
MYSQL_USER: ${DB_USERNAME:-leverage}
MYSQL_PASSWORD: ${DB_PASSWORD:-leveragepass}
volumes:
- db_data:/var/lib/mysql
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
redis:
image: redis:7-alpine
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5
restart: unless-stopped
# ---- heng-controller (可选,真实评测机控制器) ----
# heng-controller 目前没有官方发布的 Docker image,需手动构建:
# git clone https://github.com/ThinkSpiritLab/heng-controller
# cd heng-controller && docker build -t heng-controller:local .
#
# heng-controller:
# image: heng-controller:local # 本地构建的 image
# ports:
# - "5000:5000" # heng-controller 默认端口(以实际配置为准)
# environment:
# - NODE_ENV=production
# # Redis(heng-controller 内部使用)
# - REDIS_HOST=redis
# - REDIS_PORT=6379
# # 其余配置参考 heng-controller/config/ 目录
# depends_on:
# redis:
# condition: service_healthy
# restart: unless-stopped
#
# 配置完成后,在 .env 中设置:
# HENG_BASE_URL=http://heng-controller:5000
# 并参考 docs/HENG.md 了解完整接入流程。
volumes:
db_data:
redis_data:
frontend_dist: