Update order of commands in Dockerfile

This makes image caching more efficient during version updates.