In a large dutch oven, heat butter over medium-high heat. Once melted, add in sliced onions and mix. Allow to cook for 15 minutes over medium-heat, stirring occasionally.
After 15 minutes, turn heat to medium, and add garlic, salt, pepper, bay leaves, and thyme. Cook for another 20-30 minutes or until onions are brown and caramelized. Keep stirring occasionally.
Once onions are caramelized, add wine and let reduce until most of the wine has evaporated, about 5 minutes. Then stir in the flour.
Once flour is incorporated, add beef broth and bring to a boil. Once boiling, reduce to simmer for 15 minutes, stirring occasionally. Preheat oven to broil.
Fill soup bowls or crocks with soup, then add 2 slices of baguette and 1/4 cup shredded gruyere on top of each bowl. Broil for 5-6 minutes or until top is bubbly and golden. Keep an eye on it!