# 智能项目定价模型 - 测试环境 Docker Compose 配置 # 域名: pricing.test.zhicheng.ireborn.com.cn name: pricing-model-test services: # ============ 前端服务 ============ pricing-frontend-test: build: context: ./前端应用 dockerfile: Dockerfile args: - VITE_API_BASE_URL=https://pricing-api.test.zhicheng.ireborn.com.cn/api/v1 container_name: pricing-frontend-test restart: unless-stopped labels: - "traefik.enable=true" - "traefik.http.routers.pricing-frontend-test.rule=Host(`pricing.test.zhicheng.ireborn.com.cn`)" - "traefik.http.routers.pricing-frontend-test.entrypoints=websecure" - "traefik.http.routers.pricing-frontend-test.tls=true" - "traefik.http.routers.pricing-frontend-test.tls.certresolver=letsencrypt" - "traefik.http.services.pricing-frontend-test.loadbalancer.server.port=80" networks: - pricing_network_test - traefik_network healthcheck: test: ["CMD", "curl", "-f", "http://localhost/health"] interval: 30s timeout: 10s retries: 3 start_period: 10s logging: driver: "json-file" options: max-size: "10m" max-file: "3" deploy: resources: limits: cpus: '0.5' memory: 256M reservations: cpus: '0.1' memory: 64M # ============ 后端服务 ============ pricing-backend-test: build: context: ./后端服务 dockerfile: Dockerfile container_name: pricing-backend-test restart: unless-stopped env_file: - .env environment: - DATABASE_URL=mysql+aiomysql://pricing_user:pricing_test_123@pricing-mysql-test:3306/pricing_model_test?charset=utf8mb4 - PORTAL_CONFIG_API=${PORTAL_CONFIG_API} - APP_ENV=test - DEBUG=true - SECRET_KEY=${SECRET_KEY} - CORS_ORIGINS=["https://pricing.test.zhicheng.ireborn.com.cn"] labels: - "traefik.enable=true" - "traefik.http.routers.pricing-backend-test.rule=Host(`pricing-api.test.zhicheng.ireborn.com.cn`)" - "traefik.http.routers.pricing-backend-test.entrypoints=websecure" - "traefik.http.routers.pricing-backend-test.tls=true" - "traefik.http.routers.pricing-backend-test.tls.certresolver=letsencrypt" - "traefik.http.services.pricing-backend-test.loadbalancer.server.port=8000" depends_on: pricing-mysql-test: condition: service_healthy networks: - pricing_network_test - traefik_network - scrm_network - ai_strategy_network healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8000/health"] interval: 30s timeout: 10s retries: 3 start_period: 30s logging: driver: "json-file" options: max-size: "10m" max-file: "3" deploy: resources: limits: cpus: '1' memory: 512M reservations: cpus: '0.25' memory: 128M # ============ 数据库服务 ============ pricing-mysql-test: image: mysql:8.0.36 container_name: pricing-mysql-test restart: unless-stopped command: - --character-set-server=utf8mb4 - --collation-server=utf8mb4_unicode_ci - --default-time-zone=+08:00 environment: MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-root_test_123} MYSQL_DATABASE: pricing_model_test MYSQL_USER: pricing_user MYSQL_PASSWORD: ${MYSQL_PASSWORD:-pricing_test_123} volumes: - pricing_mysql_data_test:/var/lib/mysql - ./init.sql:/docker-entrypoint-initdb.d/init.sql:ro networks: - pricing_network_test healthcheck: test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p${MYSQL_ROOT_PASSWORD:-root_test_123}"] interval: 30s timeout: 10s retries: 3 start_period: 60s logging: driver: "json-file" options: max-size: "10m" max-file: "3" deploy: resources: limits: cpus: '1' memory: 1G reservations: cpus: '0.25' memory: 256M # ============ 网络配置 ============ networks: pricing_network_test: driver: bridge name: pricing_network_test traefik_network: external: true name: traefik_network scrm_network: external: true name: scrm_network ai_strategy_network: external: true name: ai_ai-strategy-network # ============ 数据卷 ============ volumes: pricing_mysql_data_test: name: pricing_mysql_data_test