version: '3.8'
services:
  mysql:
    image: mysql:8.0
    container_name: innovation-mysql
    environment:
      MYSQL_ROOT_PASSWORD: root123456
      MYSQL_DATABASE: innovation_platform
      MYSQL_USER: innovation
      MYSQL_PASSWORD: innovation123
    ports:
      - "3307:3306"
    volumes:
      - mysql-data:/var/lib/mysql
    networks:
      - innovation-network

  backend:
    build: ./backend
    container_name: innovation-backend
    depends_on:
      - mysql
    environment:
      SPRING_DATASOURCE_URL: jdbc:mysql://mysql:3306/innovation_platform?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai
      SPRING_DATASOURCE_USERNAME: innovation
      SPRING_DATASOURCE_PASSWORD: innovation123
    ports:
      - "8080:8080"
    networks:
      - innovation-network

networks:
  innovation-network:
    driver: bridge

volumes:
  mysql-data:
