I would like to start using devcontainers (Visual Studio Code - Remote Containers) on some internal projects. These projects all need access to internal package repositories (npm, maven, nuget, docker, apt, yum etc.) during their build, which generally requires providing appropriate config files (~/.npmrc
, ~/.m2/settings.xml
, ~/.config/NuGet/NuGet.Config
, /etc/apt/sources.list
etc.).
Now for convenience it might be easiest to just embed the necessary configs into the base image, but I don't want everybody to just use the same credentials, nor do I want to have the credentials stored in a base image somewhere.
VSCode automatically supports forwarding git-credential-helper and ssh-agent, and copies .gitconfig by default, but not for other tools. It also provides a way to check out additional “dotfiles” repository into the container and run a script, but again, repository is not the right tool here.
Are there better options for injecting tool credentials into a devcontainer that are not too configuration-intensive for the team members while still using their own credentials?
.npmrc
inside your container"source=${localEnv:HOME}${localEnv:USERPROFILE}/.npmrc,target=/home/node/.npmrc,type=bind,consistency=cached"
(Same can be done with the other ones) – Speculator