Pip install during build is using a different index-url from what's used locally. How does pip work in a build context?

Hi all, I’m still relatively new so please forgive my ignorance, but I’m a bit lost on pip behavior when I build vs when I run pip install locally.

In my VSCode integrated terminal, when I run pip install blah, it correctly uses the indexes from my local ~/.pip/pip.conf. The package is stored in a custom repository on AWS CodeArtifact, and I authenticate my session to obtain a 12-hour token. The authentication also slightly modifies my ~.pip/pip.conf so that my token is in the index-url, to be able to install from CodeArtifact.

However, when I run docker build -t ., the pip install step of my Dockerfile seems to be utilizing a different index-url to try and find the package, in which I get no matching distribution found (since the package only exists on CodeArtifact and not on Artifactory=.

Do I need to add a step in my Dockerfile to re-authenticate to AWS CodeArtifact during the build process in this case? Or do I need to copy my .pip/pip.conf into my build context? Is this difference in behavior happening due to some other issue?

Thanks in advance!