Change build order to better take advantage of Docker caching.