Slice onions thinly. Put onions into a large dutch oven or pot, add butter and bring to a medium-high heat on the stovetop. Add a pinch of salt and pepper, garlic, thyme and bay leaves. Cook for 25 minutes or until onions have caramelized and turned brown. Stir frequently.
Add red wine. Bring to a boil, then reduce to a simmer for 10 minutes or until liquid has reduced by half.
Stir in flour and cook for 1-2 minutes so that flour is not raw.
Add beef stock and stir until broth is thickened. Cover and let soup simmer until baguette is ready.
Heat oven to 400 (200 degrees Celsius). Slice bread and brush with olive oil. Place onto a baking sheet and bake for 5 minutes.
Remove baguette and cover each slice with gruyere. Return to oven and bake until cheese is melted.
Spoon soup into a bowl and add in baguette slices. Then enjoy!