implement whole api

* add simple tests
* move basic build functions to separate library -- dock
* improve build.sh