Imprisonment to death seems to work for civil courts. It used to be that armies on the march or in battle did not have the facilities to deal with mutiny less drastically so they would have to use summary execution, but these days that is probably not the case. The US executed one soldier for desertion in WWII, and that after a court martial. Still, it is the reason officers have sidearms.
It is worth considering that corporal punishment was also a lack of facilities issue. It is cruel and unusual now because prisons are available. But use of stocks or flogging or maiming are a sign of a society too poor to afford prisons. Justice must be seen to be done, and the punishment must be deserved. When a society is poor, it has to have punishments that still seem proportionate.