-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
137 lines (124 loc) · 3.69 KB
/
Copy pathdocker-compose.yml
File metadata and controls
137 lines (124 loc) · 3.69 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# AI-Dev-Insight 后端服务 Docker Compose 配置
services:
# MySQL 数据库
db:
image: mysql:8.0
container_name: ai-dev-insight-db
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-password}
MYSQL_DATABASE: ${MYSQL_DATABASE:-ai_dev_insight}
MYSQL_USER: ${MYSQL_USER:-ai_dev_insight}
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-password}
MYSQL_CHARACTER_SET_SERVER: utf8mb4
MYSQL_COLLATION_SERVER: utf8mb4_unicode_ci
ports:
- "${MYSQL_PORT:-3306}:3306"
volumes:
- mysql_data:/var/lib/mysql
- ./init.sql:/docker-entrypoint-initdb.d/init.sql:ro
networks:
- ai-dev-insight-network
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
timeout: 20s
retries: 10
interval: 10s
start_period: 30s
# Redis 缓存
redis:
image: redis:7-alpine
container_name: ai-dev-insight-redis
restart: unless-stopped
ports:
- "${REDIS_PORT:-6379}:6379"
volumes:
- redis_data:/data
networks:
- ai-dev-insight-network
healthcheck:
test: ["CMD", "redis-cli", "ping"]
timeout: 10s
retries: 5
interval: 10s
start_period: 10s
command: redis-server --appendonly yes
# 后端应用
backend:
build:
context: .
dockerfile: Dockerfile
args:
- BUILDKIT_INLINE_CACHE=1
image: ai-dev-insight-backend:latest
container_name: ai-dev-insight-backend
restart: unless-stopped
ports:
- "${BACKEND_PORT:-8000}:8000"
environment:
# 应用配置
APP_NAME: ${APP_NAME:-AI-Dev-Insight}
VERSION: ${VERSION:-1.0.0}
ENVIRONMENT: ${ENVIRONMENT:-production}
DEBUG: ${DEBUG:-false}
HOST: ${HOST:-0.0.0.0}
PORT: ${PORT:-8000}
# 数据库配置
DATABASE_URL: ${DATABASE_URL:-mysql+pymysql://ai_dev_insight:password@db:3306/ai_dev_insight}
DATABASE_ECHO: ${DATABASE_ECHO:-false}
# Redis 配置
REDIS_URL: ${REDIS_URL:-redis://redis:6379/0}
# CORS 配置
ALLOWED_ORIGINS: ${ALLOWED_ORIGINS:-http://localhost:3000,http://127.0.0.1:3000,http://localhost:5173}
# LLM 配置 - 本地 OpenAI 兼容服务 (如 Ollama)
LLM_PROVIDER: ${LLM_PROVIDER:-openai}
OPENAI_API_BASE: ${OPENAI_API_BASE:-http://host.docker.internal:11434/v1}
OPENAI_API_KEY: ${OPENAI_API_KEY:-ollama}
LLM_MODEL: ${LLM_MODEL:-qwen2.5-coder:7b}
LLM_TEMPERATURE: ${LLM_TEMPERATURE:-0.1}
LLM_MAX_TOKENS: ${LLM_MAX_TOKENS:-2000}
# 安全配置
SECRET_KEY: ${SECRET_KEY:-your-super-secret-key-change-in-production}
ACCESS_TOKEN_EXPIRE_MINUTES: ${ACCESS_TOKEN_EXPIRE_MINUTES:-30}
# 日志配置
LOG_LEVEL: ${LOG_LEVEL:-INFO}
LOG_FILE: ${LOG_FILE:-logs/app.log}
# 爬虫配置
CRAWL_INTERVAL_HOURS: ${CRAWL_INTERVAL_HOURS:-24}
MAX_CRAWL_RETRIES: ${MAX_CRAWL_RETRIES:-3}
CRAWL_TIMEOUT: ${CRAWL_TIMEOUT:-30}
# 代理配置 (可选)
PROXY_HTTP: ${PROXY_HTTP:-}
PROXY_HTTPS: ${PROXY_HTTPS:-}
volumes:
- ./logs:/app/logs
- ./static:/app/static
networks:
- ai-dev-insight-network
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
timeout: 10s
retries: 5
start_period: 60s
interval: 30s
deploy:
resources:
limits:
memory: 2G
cpus: '1.0'
reservations:
memory: 512M
cpus: '0.5'
volumes:
mysql_data:
driver: local
redis_data:
driver: local
networks:
ai-dev-insight-network:
driver: bridge