Files
ailine/docker/docker-compose.yml
root 065afe533c
All checks were successful
构建并部署 AI Agent 服务 / deploy (push) Successful in 27s
重新部署
2026-04-14 02:48:27 +08:00

64 lines
1.5 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

services:
postgres:
image: postgres:16
container_name: ai-postgres
environment:
POSTGRES_PASSWORD: mysecretpassword # 请替换为强密码
POSTGRES_DB: langgraph_db
volumes:
- pg_data:/var/lib/postgresql/data
networks:
- ai-network
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U postgres" ]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
# 如需外部访问数据库,取消下面注释
# ports:
# - "5432:5432"
backend:
build:
context: .. # 构建上下文为项目根目录
dockerfile: docker/Dockerfile.backend
container_name: ai-backend
environment:
- ZHIPUAI_API_KEY=${ZHIPUAI_API_KEY}
- VLLM_LOCAL_KEY=${VLLM_LOCAL_KEY}
- DB_URI=postgresql://postgres:mysecretpassword@postgres:5432/langgraph_db?sslmode=disable
volumes:
- ../data/user_docs:/app/data/user_docs # 挂载文档目录
- ../logs:/app/logs
networks:
- ai-network
depends_on:
postgres:
condition: service_healthy
restart: unless-stopped
ports:
- "8001:8001"
frontend:
build:
context: ..
dockerfile: docker/Dockerfile.frontend
container_name: ai-frontend
environment:
- API_URL=/ai/api/chat # 通过 Nginx 反向代理访问后端(路径前缀 /ai
ports:
- "8501:8501"
networks:
- ai-network
depends_on:
- backend
restart: unless-stopped
networks:
ai-network:
driver: bridge
volumes:
pg_data: