Reputation: 76306
Visual Studio now generates Dockerfile for dotnet projects, and we are using it (with slight tweaks) for our continuous integration.
However that Dockerfile does not have any provision for configuring nuget. It even only copies the .csproj
file from context before running dotnet restore
to avoid re-running that step during development.
But our project requires some modules from internal, password-protected repository, so I need to provide package sources and credentials to the dotnet restore
command inside.
What is the best current practice for injecting a (environment-specific) nuget configuration?
Upvotes: 1
Views: 1110
Reputation: 3985
This is documented here: https://github.com/dotnet/dotnet-docker/blob/main/documentation/scenarios/nuget-credentials.md.
To summarize, there are a variety of ways in which this can be done:
docker build
.No matter which option you choose, be sure that credentials are never stored within an image layer that is published.
Upvotes: 2