fix GetDBSession, optimize dockerfile for caching partial builds