-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
73 lines (69 loc) · 1.52 KB
/
docker-compose.yml
File metadata and controls
73 lines (69 loc) · 1.52 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
services:
# Redis数据库(仅内部网络)
redis:
image: redis:7-alpine
container_name: nanovote-redis
volumes:
- redis_data:/data
command: redis-server --appendonly yes
restart: unless-stopped
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
networks:
nanovote-network:
aliases:
- redis
# 后端服务(仅内部网络)
backend:
build:
context: .
dockerfile: Dockerfile.backend
container_name: nanovote-backend
environment:
- REDIS_HOST=redis
- REDIS_PORT=6379
- HOST=0.0.0.0
- PORT=8000
- DEBUG=False
- CORS_ORIGINS=http://localhost:5173
depends_on:
redis:
condition: service_healthy
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 30s
timeout: 10s
retries: 3
networks:
nanovote-network:
aliases:
- backend
# Nginx前端服务(暴露50000端口)
frontend:
build:
context: .
dockerfile: Dockerfile.frontend
container_name: nanovote-frontend
ports:
- "50000:80"
depends_on:
- backend
restart: unless-stopped
networks:
- nanovote-network
volumes:
redis_data:
driver: local
networks:
nanovote-network:
driver: bridge
enable_ipv6: true
ipam:
driver: default
config:
- subnet: 172.28.0.0/16
- subnet: 2001:db8:1::/64