63 lines
1.6 KiB
YAML
63 lines
1.6 KiB
YAML
|
|
version: '3.8'
|
||
|
|
|
||
|
|
services:
|
||
|
|
# PostgreSQL 数据库
|
||
|
|
db:
|
||
|
|
image: postgres:15
|
||
|
|
container_name: agent-diary-db
|
||
|
|
environment:
|
||
|
|
POSTGRES_DB: ${POSTGRES_DB:-agent_diary_db}
|
||
|
|
POSTGRES_USER: ${POSTGRES_USER:-agent_user}
|
||
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-agent2026}
|
||
|
|
volumes:
|
||
|
|
- pgdata:/var/lib/postgresql/data
|
||
|
|
ports:
|
||
|
|
- "5432:5432"
|
||
|
|
healthcheck:
|
||
|
|
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-agent_user}"]
|
||
|
|
interval: 10s
|
||
|
|
timeout: 5s
|
||
|
|
retries: 5
|
||
|
|
|
||
|
|
# Django 后端
|
||
|
|
web:
|
||
|
|
build:
|
||
|
|
context: ./code/backend
|
||
|
|
dockerfile: Dockerfile
|
||
|
|
container_name: agent-diary-web
|
||
|
|
command: >
|
||
|
|
sh -c "python manage.py migrate &&
|
||
|
|
python manage.py runserver 0.0.0.0:8000"
|
||
|
|
volumes:
|
||
|
|
- ${WORKSPACE_BASE:-/home/node/.openclaw/workspace}:${WORKSPACE_BASE:-/home/node/.openclaw/workspace}
|
||
|
|
ports:
|
||
|
|
- "8000:8000"
|
||
|
|
environment:
|
||
|
|
DATABASE_URL: postgresql://${POSTGRES_USER:-agent_user}:${POSTGRES_PASSWORD:-agent2026}@db:5432/${POSTGRES_DB:-agent_diary_db}
|
||
|
|
WORKSPACE_BASE: ${WORKSPACE_BASE:-/home/node/.openclaw/workspace}
|
||
|
|
SECRET_KEY: ${SECRET_KEY:-dev-secret-key}
|
||
|
|
DEBUG: ${DEBUG:-True}
|
||
|
|
depends_on:
|
||
|
|
db:
|
||
|
|
condition: service_healthy
|
||
|
|
|
||
|
|
# React 前端
|
||
|
|
frontend:
|
||
|
|
build:
|
||
|
|
context: ./code/frontend
|
||
|
|
dockerfile: Dockerfile
|
||
|
|
container_name: agent-diary-frontend
|
||
|
|
command: npm start
|
||
|
|
volumes:
|
||
|
|
- ./code/frontend:/app
|
||
|
|
- /app/node_modules
|
||
|
|
ports:
|
||
|
|
- "3000:3000"
|
||
|
|
environment:
|
||
|
|
REACT_APP_API_URL: http://localhost:8000
|
||
|
|
depends_on:
|
||
|
|
- web
|
||
|
|
|
||
|
|
volumes:
|
||
|
|
pgdata:
|