65 lines
1.4 KiB
YAML
65 lines
1.4 KiB
YAML
|
|
version: '3.8'
|
||
|
|
|
||
|
|
services:
|
||
|
|
# PostgreSQL 数据库
|
||
|
|
postgres:
|
||
|
|
image: postgres:15-alpine
|
||
|
|
container_name: lobster-postgres
|
||
|
|
environment:
|
||
|
|
POSTGRES_DB: lobster_memory
|
||
|
|
POSTGRES_USER: postgres
|
||
|
|
POSTGRES_PASSWORD: postgres
|
||
|
|
volumes:
|
||
|
|
- postgres_data:/var/lib/postgresql/data
|
||
|
|
ports:
|
||
|
|
- "5432:5432"
|
||
|
|
healthcheck:
|
||
|
|
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
||
|
|
interval: 10s
|
||
|
|
timeout: 5s
|
||
|
|
retries: 5
|
||
|
|
|
||
|
|
# Django 后端
|
||
|
|
backend:
|
||
|
|
build:
|
||
|
|
context: ./backend
|
||
|
|
dockerfile: Dockerfile
|
||
|
|
container_name: lobster-backend
|
||
|
|
environment:
|
||
|
|
DB_HOST: postgres
|
||
|
|
DB_NAME: lobster_memory
|
||
|
|
DB_USER: postgres
|
||
|
|
DB_PASSWORD: postgres
|
||
|
|
DB_PORT: 5432
|
||
|
|
LOBSTER_MEMORY_BASE: /app/memory_files
|
||
|
|
volumes:
|
||
|
|
# 挂载龙虾记忆目录
|
||
|
|
- /home/node/.openclaw/workspace/daotong:/app/memory_files:ro
|
||
|
|
# 代码热重载(开发用)
|
||
|
|
- ./backend:/app
|
||
|
|
ports:
|
||
|
|
- "8087:8087"
|
||
|
|
depends_on:
|
||
|
|
postgres:
|
||
|
|
condition: service_healthy
|
||
|
|
command: >
|
||
|
|
sh -c "
|
||
|
|
python manage.py migrate &&
|
||
|
|
python manage.py runserver 0.0.0.0:8087
|
||
|
|
"
|
||
|
|
|
||
|
|
# React 前端
|
||
|
|
frontend:
|
||
|
|
build:
|
||
|
|
context: ./frontend
|
||
|
|
dockerfile: Dockerfile
|
||
|
|
container_name: lobster-frontend
|
||
|
|
ports:
|
||
|
|
- "8086:80"
|
||
|
|
environment:
|
||
|
|
- REACT_APP_API_URL=http://localhost:8087/api
|
||
|
|
depends_on:
|
||
|
|
- backend
|
||
|
|
|
||
|
|
volumes:
|
||
|
|
postgres_data:
|