The large cruise ships that visit Portland generally embark from either Boston or NYC, and do 7 - 10 day tours of New England and Atlantic Canada, with some ending in Montreal and some returning to their port of call.
The Portland stop usually lasts for a better part of a day, though occasionally they will arrive in Portland at the crack of dawn, leave in the early afternoon and arrive in Bar Harbor in the evening.
The stops are a huge benefit to Portland, though unfortunately (in my opinion) many of the passengers immediately board buses for Freeport, Kennebunkport or Kittery. Those buses are arranged by the cruise companies and the chambers of commerce from those towns.
The only ship that has traditionally picked up or dropped off passengers in Portland is the Scotia Prince, which made an 11-hour trip to Yarmouth, Nova Scotia. They were in operation for over 30 years, but for numerous reasons that service fell apart and in the last couple years The Cat has assumed that same route, doing the trip in half the time but only stopping in Portland every other day, with Bar Harbor being their stop on the other days.
While the Scotia Prince was an aging boat (I took it once and it was an underwhelming experience) it was a fixture on the Portland waterfront in the summer, and many people made a point of watching the ship make its graceful departure from the harbor each evening at 9pm.