first version of buildimage.sh