Fix issues with env export in docker build
This MR fixes some failures exposed in the most recent attempt to build the stable environment. The main issue was a commit that existed on staging
(2fc45073) that did not exist on testing
so was included in validation of the most recent developments.