Refactor image building

This has been sitting around for a while... Splitting up building dev and prod should help simplify future changes.