Put a spoonful of vegemite (or brewers’ yeast) and a spoonful of sugar in the bottle, plus the peelings from an orange or lemon.
Add enough water to fill the bottle to about a third, put on the lid, and shake until the yeast extract and sugar have dissolved
https://www.abc.net.au/gardening/how-to/bye-bye-fruit-fly/12674168