You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
2.0 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

version: '3.8'
services:
db:
image: mysql:8.0
container_name: lingshu_db
restart: always
environment:
MYSQL_ROOT_PASSWORD: lingshu123
MYSQL_DATABASE: lingshu
MYSQL_CHARSET: utf8mb4
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --init-connect='SET NAMES utf8mb4'
volumes:
- db_data:/var/lib/mysql
- ./灵枢数据库设计.sql:/docker-entrypoint-initdb.d/01_schema.sql
- ./init_demo_data.sql:/docker-entrypoint-initdb.d/02_data.sql
ports:
- "3307:3306"
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-plingshu123"]
interval: 5s
timeout: 5s
retries: 10
app:
build: .
container_name: lingshu_app
restart: always
ports:
- "5000:5000"
environment:
DB_HOST: db
DB_PORT: 3306
DB_USER: root
DB_PASSWORD: lingshu123
DB_NAME: lingshu
# DOCKER_HOST_IP 由启动脚本自动注入Linux 用 docker0 网关 IPWindows/Mac 用 host-gateway
OPENCLAW_URL: http://${DOCKER_HOST_IP:-host-gateway}:18789
LINGSHU_CALLBACK_URL: http://${DOCKER_HOST_IP:-host-gateway}:5000
OPENCLAW_PROTOCOL: websocket
OPENCLAW_WS_PATH: /
# OpenClaw 认证 Token仅当 device 签名不可用时作为备用)
# gateway token在 OpenClaw 控制台 → 设置 → 网关令牌 复制,填入 .env
OPENCLAW_TOKEN: ${OPENCLAW_TOKEN:-}
OPENCLAW_OPERATOR_TOKEN: ${OPENCLAW_OPERATOR_TOKEN:-}
volumes:
# 挂载宿主机 OpenClaw identity 目录,用于 device 签名认证(最高权限)
# start.sh 自动将绝对路径写入 .env 的 OPENCLAW_IDENTITY_DIR
- ${OPENCLAW_IDENTITY_DIR:-/nonexistent}:/root/.openclaw/identity:ro
depends_on:
db:
condition: service_healthy
extra_hosts:
# Linux: DOCKER_HOST_IP 由 start.sh 自动填入(如 172.17.0.1
# Windows/Mac Docker Desktop: host-gateway 是内置特殊值
- "host-gateway:${DOCKER_HOST_IP:-host-gateway}"
volumes:
db_data: