I have a Docker Compose build task build out a Node.js project on VSTS. Because we're moving to a private npm registry on VSTS, this means the Docker container needs a way to authenticate with the registry to download packages.
Is there a way to send VSTS credentials to the Docker container so when it builds, it has access to the private npm registry?
I thought of hard-coding VSTS's generated npm credentials into the project's .npmrc
file, but even in that case, it wouldn't build in VSTS giving me a "401 Unauthroized" when doing yarn install
:
An unexpected error occurred: "https://[VSTS_NAME].pkgs.visualstudio.com/_packaging/[REGISTRY_NAME]/npm/registry/ajv/-/ajv-6.1.1.tgz: Request failed \"401 Unauthorized\"".