If you wanna to install from tag then do this directly
RUN npm install '@edx/frontend-component-header@4.0.0'
because installing from branches directly for production won’t work as you’ll face dist files issues. Try publishing a custom package for your header and then install that package as:
RUN npm install '@edx/frontend-component-header@npm:my-custom-package'
or try pushing your dist folder as @dcoa mentioned but I will say this is not the best approach.