-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
120 lines (114 loc) · 3.14 KB
/
docker-compose.yml
File metadata and controls
120 lines (114 loc) · 3.14 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
# ==========================================
# Docker Compose 配置文件
# 用于本地开发和测试环境
# ==========================================
services:
# ==========================================
# 前端应用服务
# ==========================================
web:
build:
context: .
dockerfile: Dockerfile
args:
NODE_ENV: production
image: ${DOCKER_REGISTRY:-docker.io}/${DOCKER_NAMESPACE:-gvray}/react-umi-admin:${VERSION:-latest}
platform: ${PLATFORM:-linux/amd64}
container_name: react-umi-admin-web
restart: unless-stopped
ports:
- "8080:80"
environment:
- TZ=Asia/Shanghai
- NODE_ENV=production
volumes:
# 挂载日志目录
- ./logs/nginx:/var/log/nginx
networks:
- app-network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost/health"]
interval: 30s
timeout: 3s
retries: 3
start_period: 10s
labels:
- "com.example.description=React UMI Admin Frontend"
- "com.example.version=1.0.0"
# ==========================================
# 后端 API 服务(示例)
# ==========================================
# backend:
# image: your-backend-image:latest
# container_name: react-umi-admin-backend
# restart: unless-stopped
# ports:
# - "3000:3000"
# environment:
# - TZ=Asia/Shanghai
# - NODE_ENV=production
# - DATABASE_URL=postgresql://user:password@db:5432/dbname
# networks:
# - app-network
# depends_on:
# - db
# healthcheck:
# test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
# interval: 30s
# timeout: 3s
# retries: 3
# ==========================================
# 数据库服务(示例)
# ==========================================
# db:
# image: postgres:15-alpine
# container_name: react-umi-admin-db
# restart: unless-stopped
# environment:
# - POSTGRES_USER=admin
# - POSTGRES_PASSWORD=password
# - POSTGRES_DB=admin_db
# - TZ=Asia/Shanghai
# volumes:
# - postgres-data:/var/lib/postgresql/data
# networks:
# - app-network
# healthcheck:
# test: ["CMD-SHELL", "pg_isready -U admin"]
# interval: 10s
# timeout: 5s
# retries: 5
# ==========================================
# Redis 缓存服务(示例)
# ==========================================
# redis:
# image: redis:7-alpine
# container_name: react-umi-admin-redis
# restart: unless-stopped
# command: redis-server --appendonly yes
# volumes:
# - redis-data:/data
# networks:
# - app-network
# healthcheck:
# test: ["CMD", "redis-cli", "ping"]
# interval: 10s
# timeout: 3s
# retries: 3
# ==========================================
# 网络配置
# ==========================================
networks:
app-network:
driver: bridge
ipam:
config:
- subnet: 172.20.0.0/16
# ==========================================
# 数据卷配置
# ==========================================
volumes:
postgres-data:
driver: local
redis-data:
driver: local