-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
41 lines (38 loc) · 1014 Bytes
/
docker-compose.yml
File metadata and controls
41 lines (38 loc) · 1014 Bytes
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
version: '3.8'
services:
# WebSSH应用
webssh:
build: .
ports:
- "3000:3000"
# 环境变量从.env.production文件加载
env_file:
- .env.production
depends_on:
mysql:
condition: service_healthy
restart: unless-stopped
healthcheck:
test: ["CMD", "node", "-e", "require('http').get('http://localhost:3000/api/auth/health', (res) => { process.exit(res.statusCode === 200 ? 0 : 1) })"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
# MySQL数据库
mysql:
image: mysql:8.0
environment:
- MYSQL_ROOT_PASSWORD=root_password
- MYSQL_DATABASE=webssh
- MYSQL_USER=webssh_user
- MYSQL_PASSWORD=webssh_password
volumes:
- mysql_data:/var/lib/mysql
- ./install.sql:/docker-entrypoint-initdb.d/install.sql
restart: unless-stopped
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
timeout: 20s
retries: 10
volumes:
mysql_data: