create directory tree before building image

this fixes file permissions when trying to run binary as non root user.