Refactor main Dockerfile into base.