Union leaders representing thousands of New York City apartment house doorpersons, superintendents and other workers said Friday that they had reached a tentative contract agreement with building owners, averting a strike at the homes of an estimated 1.5 million people.