I epulw rig a push button so that when the door is opened the light comes on.
That is how refrigerators operated forever.
A few now use magnets and reed switches now.
You could hide a reed switch in the edge of the door
framing and put a magnet in the door.
When the magnet is near the reed switch the contacts are held open.
When the magnet moves away, the contacts close.
They are usually sealed in a small glass tube with a tiny amount o
mercury to make them reliable longer term.
The mercury wets the mating surfaces of the reed switch elements.