Issue
Can some one please provide what is the recommended solution for authenticating inside Dockerfile during docker build phase for Azure Artifacts for Maven, NPM or Python?
While most of the solutions for the particular problem of accessing authenticated feed of Azure Artifacts while building from inside a Dockerfile has been mentioned on Stack Overflow or on the internet (in various articles such as below) have targeted the nuget ecosystem, my question is for Maven, NPM or Python Packages.
Example blogs that provide solutions for nuget & docker-
Appreciate the help here.
Solution
My question is for Maven, NPM or Python Packages.
These package types are from different systems, so we should use different ways to authenticate them.
For Maven:
Check set-up-your-feed
. You should configure your pom.xml
file to define the url, and then define settings.xml
file with PAT. You can manage these two files in your project, then use Dockerfile to copy the settings.xml
to ${user.home}/.m2
folder.
For NPM:
You can follow Other
topic here to configure one .npmrc
which contains credentials. Also I think you can create a normal .npmrc
file, and then use Npm Authenticate task
to modify it. Here's one working sample.
For Python:
We can use the Pip Authenticate task to populates the PIP_EXTRA_INDEX_URL
environment variable and pass it as build arguments. Something like this: arguments: --build-arg INDEX_URL=$(PIP_EXTRA_INDEX_URL)
You can check the two answers from this similar issue for more details.
Answered By - LoLance