build docker images in the correct order, add tags support