Files
ailine/docker/docker-compose.yml
root 8eccec3fb8
Some checks failed
构建并部署 AI Agent 服务 / deploy (push) Failing after 1m25s
feat: 适配 Nginx /ai/ 路径前缀
2026-04-14 02:37:42 +08:00

64 lines
1.6 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:
- "127.0.0.1:8001:8001" # 仅本机访问,供 Nginx 反向代理使用
frontend:
build:
context: ..
dockerfile: docker/Dockerfile.frontend
container_name: ai-frontend
environment:
- API_URL=/ai/api/chat # 通过 Nginx 反向代理访问后端(路径前缀 /ai
ports:
- "127.0.0.1:8501:8501" # 仅本机访问,供 Nginx 反向代理使用
networks:
- ai-network
depends_on:
- backend
restart: unless-stopped
networks:
ai-network:
driver: bridge
volumes:
pg_data: