Update Dockerfile

reorganizing code to make reusable and simpler