You mount these hinges in the edge of the door and bevel the edge opposite the hinges so the door can swing out. You can devise a magnetic latch to keep the door shut. If you can make the door fit into the opening carefully, you can get an almost zero gap.
https://www.woodcraft.com/products/soss-non-mortise-hinge-for-1-2-panels?via=573621f569702d06760016d3
https://www.woodcraft.com/products/soss-non-mortise-hinge-for-1-2-panels?via=573621f569702d06760016d3