A boundary element approach to bacteria approaching boundaries