Roll the pastry out to a thickness of about a quarter inch. Cut out 4 circles about 5 inches in diameter. Pile the pastry circles on a plate and keep in the fridge till required.
Peel the outside skin from the onions leaving the base and stalk intact.
Pour the milk into a small saucepan, season with salt and freshly ground black pepper.
Add the bay leaves and onions and bring to the boil. Turn the heat down and simmer for about 10 minutes until a knife can be inserted into outside layers of the onions easily but the hearts remain crunchy. Drain in a colander.
Peel off the outer layer of the onion, and halve each one across the middle.
Put in the onions cut-side down. Bring to the boil and simmer for ten minutes, adding the port (if using) halfway through the simmering time.
As the wine reduces, roll the onions around from time to time, until they are well coated and almost tender in the centre.
Strain what is left of the red wine reduction and reduce down the liquid to a thick sauce.
Put the onion halves on a rack placed over the pan and leave until cold and dry. Trim off the root and stalks.
Cover each onion half with a circle of pastry. Slightly tuck the edges underneath the edge of each onion.
Take the pan of reduced sauce and pour a little into each of 4 small tart tins. Place an onion half, in its pastry blanket, on top and cook in the preheated oven for about 10 minutes, until the pastry is golden brown and the edges caramelized.
When cooked, remove the "tartes tatins" from the oven and with a spatula, carefully flip them over onion side up (do not touch the hot caramel!), onto 4 plates.
Place slices of goatcheese on top of each tart, then return to the top shelf of the oven until melted.