-
Notifications
You must be signed in to change notification settings - Fork 742
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
54 lines (51 loc) · 1.33 KB
/
docker-compose.yml
File metadata and controls
54 lines (51 loc) · 1.33 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
services:
backend:
container_name: bilinote-backend
build:
context: .
dockerfile: backend/Dockerfile
args:
APT_MIRROR: ${APT_MIRROR:-mirrors.tuna.tsinghua.edu.cn}
PIP_INDEX: ${PIP_INDEX:-https://pypi.tuna.tsinghua.edu.cn/simple}
env_file:
- .env
environment:
- BACKEND_PORT=${BACKEND_PORT}
- BACKEND_HOST=${BACKEND_HOST}
volumes:
- ./backend:/app
expose:
- "${BACKEND_PORT}" # 不再对外暴露,用于 nginx 内部通信
restart: on-failure:3
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:${BACKEND_PORT}/api/sys_health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 15s
mem_limit: 4g
frontend:
container_name: bilinote-frontend
build:
context: .
dockerfile: BillNote_frontend/Dockerfile
env_file:
- .env
expose:
- "80" # 不暴露给宿主机,只供 nginx 访问
restart: on-failure:3
mem_limit: 512m
nginx:
container_name: bilinote-nginx
image: nginx:1.25-alpine
ports:
- "${APP_PORT}:80"
volumes:
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf
depends_on:
backend:
condition: service_healthy
frontend:
condition: service_started
restart: on-failure:3
mem_limit: 256m