-
-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
118 lines (112 loc) · 3.12 KB
/
docker-compose.yml
File metadata and controls
118 lines (112 loc) · 3.12 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
networks:
fba_network:
name: fba_network
driver: bridge
ipam:
driver: default
config:
- subnet: 172.10.10.0/24
volumes:
# 如果你是 mysql 用户,应将 fba_postgres 修改为 fba_mysql
fba_postgres:
name: fba_postgres
fba_redis:
name: fba_redis
fba_static:
name: fba_static
fba_static_upload:
name: fba_static_upload
services:
fba_server:
build:
context: .
dockerfile: Dockerfile
image: fba_server:latest
ports:
- "${DOCKER_MAP_SERVER_PORT:-8001}:8001"
container_name: fba_server
restart: always
environment:
- TZ=Asia/Shanghai
# 如果你是 mysql 用户,应将 fba_postgres 修改为 fba_mysql
depends_on:
- fba_postgres
- fba_redis
volumes:
- ./deploy/backend/docker-compose/.env.server:/fba/backend/.env
- fba_static:/fba/backend/app/static
- fba_static_upload:/fba/backend/static/upload
- ${DOCKER_FBA_SERVER_LOG:-./logs/fba}:/var/log/fba
networks:
- fba_network
# 如果你是 mysql 用户,应将 fba_postgres:5432 修改为 fba_mysql:3306
command:
- bash
- -c
- |
wait-for-it -s fba_postgres:5432 -s fba_redis:6379 -t 300
supervisord -c /etc/supervisor/supervisord.conf
supervisorctl restart
fba_postgres:
image: postgres:16
ports:
- "${DOCKER_MAP_POSTGRES_PORT:-5432}:5432"
container_name: fba_postgres
restart: always
environment:
POSTGRES_DB: fba
POSTGRES_PASSWORD: 123456
TZ: Asia/Shanghai
volumes:
- fba_postgres:/var/lib/postgresql/data
networks:
- fba_network
# # 如果你是 mysql 用户,应保留 fba_mysql 容器脚本并删除 fba_postgres 容器脚本
# fba_mysql:
# image: mysql:8.0.41
# ports:
# - "${DOCKER_MAP_MYSQL_PORT:-3306}:3306"
# container_name: fba_mysql
# restart: always
# environment:
# MYSQL_DATABASE: fba
# MYSQL_ROOT_PASSWORD: 123456
# TZ: Asia/Shanghai
# volumes:
# - fba_mysql:/var/lib/mysql
# networks:
# - fba_network
# command:
# --default-authentication-plugin=mysql_native_password
# --character-set-server=utf8mb4
# --collation-server=utf8mb4_general_ci
# --lower_case_table_names=1
fba_redis:
image: redis
ports:
- "${DOCKER_MAP_REDIS_PORT:-6379}:6379"
container_name: fba_redis
restart: always
environment:
- TZ=Asia/Shanghai
volumes:
- fba_redis:/data
networks:
- fba_network
# 【后端专用】
# 如果使用此容器,意味着你只需部署后端 API 服务,不需要前端
# 这与下面的 fba_ui 容器冲突,如果你选择使用 fba_ui 容器,你应该注释或删除 fba_nginx 容器脚本
fba_nginx:
image: nginx
ports:
- "${DOCKER_MAP_NGINX_PORT:-8000}:80"
container_name: fba_nginx
restart: always
depends_on:
- fba_server
volumes:
- ./deploy/backend/nginx.conf:/etc/nginx/conf.d/default.conf:ro
- fba_static:/www/fba_server/backend/static
- fba_static_upload:/www/fba_server/backend/static/upload
networks:
- fba_network