In 1967, the US signed the Outer Space Treaty. Article IV states that the "establishment of military bases, installations and fortifications… …on celestial bodies shall be forbidden".
There is a similar treaty that applies to Antarctica. We know how to build bases there (there are over 50 research stations in Antarctica). If the Antarctic Treaty was broken by building a military base, there'd be a precedence for building a military base on the Moon too — once we've figured out how — and breaking the Outer Space Treaty.