services:
  mysql:
    image: mysql:8
    container_name: qms-mysql
    restart: unless-stopped
    ports:
      - "3306:3306"
    environment:
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-password}
      MYSQL_DATABASE: ${MYSQL_DATABASE:-qms}
    volumes:
      - qms-mysql-data:/var/lib/mysql
    healthcheck:
      test:
        [
          "CMD",
          "mysqladmin",
          "ping",
          "-h",
          "localhost",
          "-p${MYSQL_ROOT_PASSWORD:-password}",
        ]
      interval: 5s
      timeout: 5s
      retries: 20
      start_period: 20s
    networks:
      - qms-net

volumes:
  qms-mysql-data:

networks:
  qms-net:
    driver: bridge
