You are setting errexit option,
and your build is dying at the first sign of trouble.
I would guess that the logs are not flushed when the script dies, giving you an impression that the build is failing at different points.
I would suggest removing set -eto figure out how exactly things are failing for you.