Rearrange Dockerfile for faster builds.