build: refactoring sphinx and image building