How do I locally specify the path for nuget in my dockerfile?

25 Views Asked by At

I have a Dockerfile created

FROM nexus...aspnet:6.0 AS base

RUN docker builder prune

WORKDIR /app
OPEN 80
OPEN 443

FROM nexus...sdk:6.0 AS build

WORKDIR /src

COPY [".", "."]


COPY NugetPackages NugetPackages
COPY Nuget.Config Nuget.Config

ans my Nuget.Config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <packageSources>
        <add key="local nuget" value="NugetPackages" />
    </packageSources>
</configuration>

I get an error when building a Dockerfile

#10 [build  7/11] RUN dotnet restore "ServiceR.csproj" --configfile Nuget.Config --verbosity normal

#10 2.182          Installed Microsoft.VisualStudio.Azure.Containers.Tools.Targets 1.19.5 from /src/NugetPackages with content hash Kaa1rBZdJFq5A0qgAcl6Bmk/UqLXTq9acEqxUlPEBA8oscmakLfkvuSXfG7Wa9t1/keaT85EuuDNgOo+Z9VYOQ==.
#10 3.134          Installed Stimulsoft.Reports.Web.NetCore 2023.4.4 from /src/NugetPackages with content hash SLcXZ6JUVEpIQISj+L7g7NxZQRbxHWmjaUMQD/WZ5PS40w1M0SP2tgvEyLfq0S0BCJ1ivfsGfFs9iTW2dE83Qw==.
#10 3.167      1>/src/ServiceR.csproj : error NU1101: Unable to find package Microsoft.AspNet.WebApi.Core. No packages exist with this id in source(s): local nuget
#10 3.167      1>/src/ServiceR.csproj : error NU1101: Unable to find package Microsoft.AspNet.Cors. No packages exist with this id in source(s): local nuget
#10 3.167      1>/src/ServiceR.csproj : error NU1101: Unable to find package Microsoft.AspNetCore.Hosting. No packages exist with this id in source(s): local nuget
#10 3.167      1>/src/ServiceR.csproj : error NU1101: Unable to find package Microsoft.AspNetCore.Html.Abstractions. No packages exist with this id in source(s): local nuget
#10 3.167      1>/src/ServiceR.csproj : error NU1101: Unable to find package Microsoft.AspNetCore.Http.Abstractions. No packages exist with this id in source(s): local nuget
#10 3.167      1>/src/ServiceR.csproj : error NU1101: Unable to find package Microsoft.AspNetCore.Mvc.RazorPages. No packages exist with this id in source(s): local nuget
#10 3.167      1>/src/ServiceR.csproj : error NU1101: Unable to find package Microsoft.AspNetCore.Mvc.ViewFeatures. No packages exist with this id in source(s): local nuget
#10 3.167      1>/src/ServiceR.csproj : error NU1101: Unable to find package Microsoft.AspNetCore.Routing. No packages exist with this id in source(s): local nuget
#10 3.167      1>/src/ServiceR.csproj : error NU1101: Unable to find package Microsoft.AspNetCore.Routing.Abstractions. No packages exist with this id in source(s): local nuget
#10 3.167      1>/src/ServiceR.csproj : error NU1101: Unable to find package Microsoft.Extensions.Caching.Memory. No packages exist with this id in source(s): local nuget
#10 3.167      1>/src/ServiceR.csproj : error NU1101: Unable to find package Microsoft.Extensions.Primitives. No packages exist with this id in source(s): local nuget
#10 3.167      1>/src/ServiceR.csproj : error NU1101: Unable to find package System.Text.Encoding.CodePages. No packages exist with this id in source(s): local nuget
#10 3.167      1>/src/ServiceR.csproj : error NU1101: Unable to find package Stimulsoft.Reports.Engine.NetCore. No packages exist with this id in source(s): local nuget
#10 3.167      1>/src/ServiceR.csproj : error NU1101: Unable to find package Swashbuckle.AspNetCore.Swagger. No packages exist with this id in source(s): local nuget
#10 3.167      1>/src/ServiceR.csproj : error NU1101: Unable to find package Swashbuckle.AspNetCore.SwaggerGen. No packages exist with this id in source(s): local nuget
#10 3.167      1>/src/ServiceR.csproj : error NU1101: Unable to find package Swashbuckle.AspNetCore.SwaggerUI. No packages exist with this id in source(s): local nuget
#10 3.167      1>/src/ServiceR.csproj : error NU1101: Unable to find package Microsoft.Extensions.ApiDescription.Server. No packages exist with this id in source(s): local nuget
#10 3.266      1>/src/ServiceR.csproj : warning NU1701: Package 'Microsoft.AspNet.WebApi.Cors 5.3.0' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8, .NETFramework,Version=v4.8.1' instead of the project target framework 'net6.0'. This package may not be fully compatible with your project.
#10 3.307          Generating MSBuild file /src/obj/ServiceR.csproj.nuget.g.props.
#10 3.312          Generating MSBuild file /src/obj/ServiceR.csproj.nuget.g.targets.
#10 3.312          Writing assets file to disk. Path: /src/obj/project.assets.json
#10 3.331          Failed to restore /src/ServiceR.csproj (in 1.51 sec).
#10 3.336          
#10 3.336          NuGet Config files used:
#10 3.336              /src/Nuget.Config
#10 3.337          
#10 3.337          Feeds used:
#10 3.337              /src/NugetPackages
#10 3.339          
#10 3.339          Installed:
#10 3.342              4 package(s) to /src/ServiceR.csproj
#10 3.345      1>Done Building Project "/src/ServiceR.csproj" (Restore target(s)) -- FAILED.
#10 3.354 
#10 3.354 Build FAILED.
#10 3.355 
#10 3.355        "/src/ServiceR.csproj" (Restore target) (1) ->
#10 3.355        (Restore target) -> 
#10 3.355          /src/ServiceR.csproj : warning NU1701: Package 'Microsoft.AspNet.WebApi.Cors 5.3.0' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8, .NETFramework,Version=v4.8.1' instead of the project target framework 'net6.0'. This package may not be fully compatible with your project.

It seems to be downloading, but an error occurs. I don't understand why. Where did I go wrong?

I understand that my nuget versions must come from the csproj file when building, and they are specified as

<PackageReference Include="Microsoft.AspNet.WebApi.Cors" Version="5.3.0" />
    <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.5" />
    <PackageReference Include="Stimulsoft.Reports.Web.NetCore" Version="2023.4.4" />
    <PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" /> 

I downloaded them from nuget.org and put them in the NugetPackages project when building. But it doesn't see them. I changed different versions, but it didn't help. I have a closed environment and no internet. I need to deploy everything locally, but I don't know where I went wrong

0

There are 0 best solutions below