CFY-1308 Some refactoring to make docker file logics consistent