version: "3.8"

services:
  flask-app:
    build: .
    ports:
      - "5000:5000"
    depends_on:
      - mysql
    environment:
      - MYSQL_HOST=mysql
      - MYSQL_USER=root
      - MYSQL_PASSWORD=root
      - MYSQL_DB=test
    networks:
      - mynetwork

  mysql:
    image: mysql:8.0
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: test
    ports:
      - "3306:3306"
    volumes:
      - mysql-data:/var/lib/mysql
    networks:
      - mynetwork

volumes:
  mysql-data:

networks:
  mynetwork:
