I have an asp.net core webapi solution which uses a NuGet package from a private repository located in a share network drive.
What i did was to add a nuget.linux.config file in the project directory with the following lines:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<packageSources>
<add key="myrepo" value="/nuget/myrepo/" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
</configuration>
I tried to copy the content of the nugetpackage private server in the nuget/myrepo folder. The dockerfile looks like:
FROM microsoft/dotnet:2.1-runtime AS base
WORKDIR /app
FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /src
COPY projectfolder/NuGet.linux.config .
COPY projectfolder/project.csproj projectfolder/
VOLUME /nuget/myrepo/
COPY \\networkpath\to\the\nuget_packages_folder /nuget/myrepo/
RUN dotnet restore projectfolder/project.csproj
COPY . .
WORKDIR /src/projectfolder
RUN dotnet build project.csproj -c Release -o /app --no-restore
FROM build AS publish
RUN dotnet publish project.csproj -c Release -o /app --no-restore
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "project.dll"]
But this doesn't work.. How can I create a container image of a project that makes reference to a nuget package in a share network using docker-compose project in vs2017?
If the project is built in debug mode, it is not needed to add the nuget.config file and it is not needed to modify the dockerfile with
COPY \\networkpath\to\the\nuget_packages_folder /nuget/myrepo/
The problem only comes in release mode.