Safe way to include a NuGet private source in a Docker container

I’m setting up a Docker container for my ASP.NET Core server and need to find a safe way for restoring NuGet packages before building and running the project.

I’ve managed to mount a drive containing a new NuGet.config file solely created for this purpose, as my team doesn’t include the config file as a part of the Git repository, but it feels wrong.
As the official Docker image for .NET Core runtime/sdk doesn’t include nuget as a part of the library, some have suggesting downloading a windows image just to run nuget source add but that seems terrible as well.

My Dockerfile:

FROM mcr.microsoft.com/dotnet/core/aspnet:2.2 AS base
WORKDIR /app
EXPOSE 5050

FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build
WORKDIR /src
COPY . .

#Config file needs to be in root of solution or in User/share
RUN dotnet restore "MyProject.csproj"

Adding a private NuGet source should be achievable without downloading a 2GB windows image or copying an existing config file that includes the password.

Source: StackOverflow