Change the order of Dockerfile command to reduce build time