Files
smart-project-pricing/docker-compose.dev.yml
2026-01-31 21:33:06 +08:00

85 lines
2.1 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 智能项目定价模型 - 开发环境 Docker Compose 配置
# 支持热重载
# 注意Docker Compose V2 已弃用 version 字段
name: pricing-model-dev
services:
# ============ 前端服务(开发模式)============
pricing-frontend:
build:
context: ./前端应用
dockerfile: Dockerfile.dev
container_name: pricing-frontend-dev
restart: unless-stopped
ports:
- "3000:3000"
volumes:
- ./前端应用:/app
- /app/node_modules
environment:
- NODE_ENV=development
networks:
- pricing_network
command: pnpm dev --host
# ============ 后端服务(开发模式)============
pricing-backend:
build:
context: ./后端服务
dockerfile: Dockerfile.dev
container_name: pricing-backend-dev
restart: unless-stopped
ports:
- "8000:8000"
volumes:
- ./后端服务:/app
env_file:
- .env.dev
environment:
- APP_ENV=development
- DEBUG=true
depends_on:
pricing-mysql:
condition: service_healthy
networks:
- pricing_network
command: uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
# ============ 数据库服务 ============
pricing-mysql:
image: mysql:8.0.36
container_name: pricing-mysql-dev
restart: unless-stopped
command:
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci
- --default-time-zone=+08:00
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: root123
MYSQL_DATABASE: pricing_model
MYSQL_USER: pricing_user
MYSQL_PASSWORD: pricing123
volumes:
- pricing_mysql_data_dev:/var/lib/mysql
- ./init.sql:/docker-entrypoint-initdb.d/init.sql:ro
networks:
- pricing_network
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-proot123"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
networks:
pricing_network:
driver: bridge
name: pricing_network_dev
volumes:
pricing_mysql_data_dev:
name: pricing_mysql_data_dev