51 lines
984 B
YAML
51 lines
984 B
YAML
version: '3.8'
|
|||
|
|
|
||
|
|
services:
|
||
|
|
# PostgreSQL 数据库
|
||
|
|
postgres:
|
||
|
|
image: postgres:15-alpine
|
||
|
|
container_name: agent-task-postgres
|
||
|
|
environment:
|
||
|
|
POSTGRES_DB: agent_tasks
|
||
|
|
POSTGRES_USER: postgres
|
||
|
|
POSTGRES_PASSWORD: postgres
|
||
|
|
ports:
|
||
|
|
- "5432:5432"
|
||
|
|
volumes:
|
||
|
|
- postgres_data:/var/lib/postgresql/data
|
||
|
|
healthcheck:
|
||
|
|
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
||
|
|
interval: 10s
|
||
|
|
timeout: 5s
|
||
|
|
retries: 5
|
||
|
|
networks:
|
||
|
|
- agent-network
|
||
|
|
|
||
|
|
# 应用服务
|
||
|
|
app:
|
||
|
|
build: .
|
||
|
|
container_name: agent-task-service
|
||
|
|
environment:
|
||
|
|
DB_HOST: postgres
|
||
|
|
DB_PORT: 5432
|
||
|
|
DB_NAME: agent_tasks
|
||
|
|
DB_USER: postgres
|
||
|
|
DB_PASSWORD: postgres
|
||
|
|
PORT: 3000
|
||
|
|
ports:
|
||
|
|
- "3000:3000"
|
||
|
|
depends_on:
|
||
|
|
postgres:
|
||
|
|
condition: service_healthy
|
||
|
|
networks:
|
||
|
|
- agent-network
|
||
|
|
restart: unless-stopped
|
||
|
|
|
||
|
|
volumes:
|
||
|
|
postgres_data:
|
||
|
|
driver: local
|
||
|
|
|
||
|
|
networks:
|
||
|
|
agent-network:
|
||
|
|
driver: bridge
|