Files
ailine/docker/docker-compose.yml

64 lines
1.5 KiB
YAML
Raw Normal View History

version: '3.8'
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
frontend:
build:
context: ..
dockerfile: docker/Dockerfile.frontend
container_name: ai-frontend
environment:
- API_URL=http://backend:8001/chat
ports:
- "8501:8501"
networks:
- ai-network
depends_on:
- backend
restart: unless-stopped
networks:
ai-network:
driver: bridge
volumes:
pg_data: