Templatize the mesos* docker image builds

Templatize the building of images, so that the version can be specified
at build time. Move them into the same directory, since mesos-master and
mesos-slave both depend on the mesos base image. Tag the docker images
with the full package version string, since that is what we pin to.