01 -
Preheat the oven to 350°F (175°C). Lightly grease a 9x13 or deep 9x9 baking dish with butter and set aside.
02 -
Heat olive oil in a medium skillet over medium heat. Add the onions, season with salt and pepper, and cook until golden and caramelized, stirring occasionally. Set aside.
03 -
In the same skillet, cook the bacon until crisp. Alternatively, bake the bacon in the oven while the onions cook to save time. Drain grease and set bacon aside.
04 -
Melt butter in a clean skillet over medium heat. Sprinkle in flour and whisk continuously to form a roux. Cook for 2 minutes.
05 -
Slowly add milk to the roux, whisking constantly. Keep whisking until the mixture reaches a simmer and thickens slightly (about 2–3 minutes). Set aside.
06 -
In the prepared baking dish, layer half of the potatoes, half of the caramelized onions, half the bacon, half the cheese, and half the sauce. Repeat the layering process with the remaining ingredients.
07 -
Cover the dish with foil and bake for 1 hour. Remove the foil and bake for an additional 30 minutes, or until the potatoes are tender and easily pierced with a fork.
08 -
Remove from oven and allow to cool for 10 minutes before serving.