Huaxu Sentinel Active Safety Platform with embedded algorithm code, Docker Compose setup, and vendored dataset scaffolds for clone-and-run. Co-authored-by: Cursor <cursoragent@cursor.com>
112 lines
2.6 KiB
YAML
112 lines
2.6 KiB
YAML
# HSAP — Huaxu Sentinel Active Safety Platform
|
|
# 用法: docker compose up -d
|
|
# docker compose --profile dev up -d # 含 Vite 热更新
|
|
|
|
name: hsap
|
|
|
|
x-platform-env: &platform-env
|
|
AS_DB_HOST: postgres
|
|
AS_DB_PORT: "5432"
|
|
AS_DB_USER: as_platform
|
|
AS_DB_PASSWORD: as_platform
|
|
AS_DB_NAME: as_platform
|
|
AS_REDIS_URL: redis://redis:6379/0
|
|
AS_JOB_EXECUTOR: worker
|
|
AS_DEV_AUTH: "true"
|
|
AS_JWT_SECRET: dev-docker-secret
|
|
AS_FRONTEND_URL: http://127.0.0.1:8787
|
|
FEISHU_REDIRECT_URI: http://127.0.0.1:8787/api/v1/auth/feishu/callback
|
|
|
|
x-platform-volumes: &platform-volumes
|
|
- .:/data/hsap
|
|
- ${AS_WORKSPACE_ROOT:-./.workspace-stub}:/data/workspace:ro
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
container_name: hsap-postgres
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_USER: as_platform
|
|
POSTGRES_PASSWORD: as_platform
|
|
POSTGRES_DB: as_platform
|
|
ports:
|
|
- "${AS_DB_PORT:-5432}:5432"
|
|
volumes:
|
|
- hsap_pgdata:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U as_platform -d as_platform"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 8
|
|
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: hsap-redis
|
|
restart: unless-stopped
|
|
ports:
|
|
- "${AS_REDIS_PORT:-6379}:6379"
|
|
volumes:
|
|
- hsap_redis:/data
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 8
|
|
|
|
platform:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
container_name: hsap-platform
|
|
restart: unless-stopped
|
|
ports:
|
|
- "${AS_PLATFORM_PORT:-8787}:8787"
|
|
environment:
|
|
<<: *platform-env
|
|
volumes: *platform-volumes
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
|
|
worker:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
container_name: hsap-worker
|
|
restart: unless-stopped
|
|
environment:
|
|
<<: *platform-env
|
|
volumes: *platform-volumes
|
|
command: ["python", "scripts/worker.py"]
|
|
depends_on:
|
|
platform:
|
|
condition: service_started
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
|
|
web-dev:
|
|
profiles: ["dev"]
|
|
image: node:22-alpine
|
|
container_name: hsap-web-dev
|
|
working_dir: /app
|
|
ports:
|
|
- "${AS_WEB_DEV_PORT:-5173}:5173"
|
|
environment:
|
|
VITE_API_PROXY: http://platform:8787
|
|
volumes:
|
|
- ./platform/web:/app
|
|
- web_node_modules:/app/node_modules
|
|
command: sh -c "npm install && npm run dev -- --host 0.0.0.0"
|
|
depends_on:
|
|
- platform
|
|
|
|
volumes:
|
|
hsap_pgdata:
|
|
hsap_redis:
|
|
web_node_modules:
|