Build script improvements

Small improvements to the build script:
- Refactor the local build to improve clarity of build output
- Improve error handling
- Fix Docker build