The best way to do this is to found a military only city early in the game. The rule is this city only has a certain number of buildings allowed in it: barracks, forge, stables, drydock (if coastal), factory and powerplant (eventually), and the all important national wonders heroic epic and west point. It will constantly build troops. It's only allowed a break from building troops if you're in peacetime AND you just teched to one of the new buildings like drydock or west point. Once the new building is done, even if you're still at peace, get back to spamming units. I usually found my second city with this idea in mind, and stick to the game plan. I guess there is the odd time when the city will outgrow its health cap so you may have to actually build the odd extra building like a harbor or aquaduct, however I typically am playing a fairly warlike game and will solve my happiness and health issues by capturing and extorting more resources, rather than wasting time building aquaducts and grocers etc.
With a steady stream of well promoted troops coming out of just one city, you can ensure a high power rating, and the ability to completely stomp any idiotic AI that decides to attack you despite your superior forces. You can usually even stop them from pillaging a single of your tiles. It's a lot more effective to be able to properly defend yourself, then fighting these seesaw battles at your border cities and watching their population and culture get destroyed because you lost them and had to take it back. Nevermind the fact that having your resources pillaged is a great way to ****** the growth of your entire civ, and when it's so easy to prevent, you have to ask yourself-- why am I not getting this? Defend your people and their land, that's why you're in charge.