# 本地开发模式 - 不使用 Docker 构建,直接挂载代码运行 version: '3.8' services: # 后端服务 - 使用本地 Python scoring-backend: image: python:3.12-slim container_name: cywl-scoring-backend working_dir: /app volumes: - ./backend:/app ports: - "8876:8876" environment: - DEBUG=True - SECRET_KEY=local-dev-secret-key - DB_NAME=scoring_system - DB_USER=postgres - DB_PASSWORD=password - DB_HOST=host.docker.internal - DB_PORT=5432 command: > sh -c "pip install -r requirements.txt && python manage.py migrate && python manage.py runserver 0.0.0.0:8876" extra_hosts: - "host.docker.internal:host-gateway" # 前端服务 - 使用本地 Node scoring-frontend: image: node:20-alpine container_name: cywl-scoring-frontend working_dir: /app volumes: - ./frontend:/app ports: - "5173:5173" environment: - VITE_API_URL=http://localhost:8876/api command: > sh -c "npm install && npm run dev -- --host 0.0.0.0"