Authenticate with Azure Artifacts from Dockerfile for Java(Maven), NPM

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.

Source: Docker Questions