-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.x86.yml
84 lines (77 loc) · 1.92 KB
/
docker-compose.x86.yml
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
version: '2.8'
services:
# 数据库服务
postgres:
image: docker-hub.pigeon-server.cn/library/postgres:13-alpine
container_name: postgres
restart: always
environment:
POSTGRES_DB: 'sm_sys_data'
POSTGRES_USER: 'ServerManager'
POSTGRES_PASSWORD: 'ServerManager'
volumes:
- ServerManager_db:/var/lib/postgresql/data
networks:
- backend
# 缓存
redis:
image: docker-hub.pigeon-server.cn/library/redis:latest
container_name: redis
restart: always
networks:
- backend
# 应用服务器
django_app:
build:
context: . # Dockerfile 的上下文路径
dockerfile: Dockerfile.x86 # 指定要使用的 Dockerfile
container_name: django_app
restart: always
environment:
DEBUG: 'False'
DJANGO_SETTINGS_MODULE: 'ServerManager.settings'
DATABASE_URL: 'postgres://ServerManager:ServerManager@postgres:5432/sm_sys_data'
REDIS_URL: 'redis://redis:6379'
volumes:
- ServerManager_app:/app/data
- ServerManager_app:/app/logs
links:
- redis
- postgres
depends_on:
- postgres
- redis
networks:
- backend
# 编译静态资源
build_static:
build:
context: ./web_develop
dockerfile: Dockerfile.x86
volumes:
- ServerManager_static:/app/dist
command: [ "sh", "-c", "npm install && npm run build" ]
# 反向代理
nginx:
image: docker-hub.pigeon-server.cn/library/nginx:latest
container_name: nginx
restart: always
volumes:
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf # 你需要在项目根目录创建nginx.conf文件
- ServerManager_static:/www/static
links:
- django_app
ports:
- "80:80"
- '443:443'
depends_on:
- build_static
- django_app
networks:
- backend
volumes:
ServerManager_db:
ServerManager_app:
ServerManager_static:
networks:
backend: