-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.baota.yml
More file actions
57 lines (53 loc) · 1.41 KB
/
Copy pathdocker-compose.baota.yml
File metadata and controls
57 lines (53 loc) · 1.41 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
# ============================================
# TensorHub Community - 宝塔面板部署 Docker Compose
# 仅运行后端 + 数据库(前端由宝塔 Nginx 管理)
# 使用方式: docker compose -f docker-compose.baota.yml up -d
# ============================================
services:
db:
image: postgres:16
restart: always
environment:
POSTGRES_DB: tensorhub
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?请在 .env 中设置 POSTGRES_PASSWORD}
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres}"]
interval: 10s
timeout: 5s
retries: 5
networks:
- internal
backend:
build:
context: ./backend
dockerfile: Dockerfile
restart: always
env_file:
- .env
depends_on:
db:
condition: service_healthy
ports:
- "127.0.0.1:8100:8000"
volumes:
- uploads:/app/uploads
# 映射上传目录到项目目录,方便 Nginx 直接提供静态文件
- /www/wwwroot/TensorHubCommunity/uploads:/app/uploads
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
networks:
- internal
- proxy
volumes:
postgres_data:
uploads:
networks:
internal:
proxy: