services: mysql: image: mysql:8.4 container_name: lifanghe-mysql command: --character-set-server=utf8mb4 --collation-server=utf8mb4_0900_ai_ci environment: MYSQL_ROOT_PASSWORD: root123456 MYSQL_DATABASE: lifanghe_education MYSQL_USER: lifanghe MYSQL_PASSWORD: lifanghe123 TZ: Asia/Shanghai ports: - "3306:3306" volumes: - mysql_data:/var/lib/mysql - ./backend/sql/init.sql:/docker-entrypoint-initdb.d/01-init.sql:ro healthcheck: test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "-ulifanghe", "-plifanghe123"] interval: 10s timeout: 5s retries: 10 backend: image: node:20-alpine container_name: lifanghe-backend working_dir: /app depends_on: mysql: condition: service_healthy environment: NODE_ENV: development PORT: 3100 DB_CLIENT: mysql MYSQL_HOST: mysql MYSQL_PORT: 3306 MYSQL_USER: lifanghe MYSQL_PASSWORD: lifanghe123 MYSQL_DATABASE: lifanghe_education WECHAT_APP_ID: ${WECHAT_APP_ID:-} WECHAT_APP_SECRET: ${WECHAT_APP_SECRET:-} TZ: Asia/Shanghai ports: - "3100:3100" volumes: - ./backend:/app - backend_node_modules:/app/node_modules command: sh -c "npm install && npm start" front-h5: image: node:20-alpine container_name: lifanghe-front-h5 working_dir: /app depends_on: - backend environment: VITE_API_BASE_URL: http://127.0.0.1:3100/api TZ: Asia/Shanghai ports: - "5177:5177" volumes: - ./front:/app - front_node_modules:/app/node_modules command: sh -c "npm install && npm run dev:h5 -- --host 0.0.0.0 --port 5177" pc-admin: image: node:20-alpine container_name: lifanghe-pc-admin working_dir: /app depends_on: - backend environment: VITE_APP_BASE_API: http://127.0.0.1:3100/api TZ: Asia/Shanghai ports: - "5174:5174" volumes: - ./pc-admin:/app - pc_admin_node_modules:/app/node_modules command: sh -c "npm install && npx vite --host 0.0.0.0 --port 5174" volumes: mysql_data: backend_node_modules: front_node_modules: pc_admin_node_modules: