Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

visual studio docker error: NU1301: Unable to > load the service index for source #2738

Open
TimOfTcc opened this issue Jun 17, 2023 · 0 comments

Comments

@TimOfTcc
Copy link

Dear All.

I can not containerize .NET Web Api project in Visual Studio 2022.Below is my dockerfile:

FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
WORKDIR /app
EXPOSE 80

FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /src
COPY ["API.Authentication/API.Authentication.csproj", "API.Authentication/"]
COPY ["API.Core/API.Core.csproj", "API.Core/"]
COPY ["Infrastructure.Persistence/Infrastructure.Persistence.csproj", "Infrastructure.Persistence/"]
COPY ["Core.Application/Core.Application.csproj", "Core.Application/"]
COPY ["Core.Domain/Core.Domain.csproj", "Core.Domain/"]
COPY ["Infrastructure.CustomAttributes/Infrastructure.CustomAttributes.csproj", "Infrastructure.CustomAttributes/"]
COPY ["Shared.Kernel/Shared.Kernel.csproj", "Shared.Kernel/"]
COPY ["Shared.ViewModel/Shared.ViewModel.csproj", "Shared.ViewModel/"]
RUN dotnet restore "API.Authentication/API.Authentication.csproj"
COPY . .
WORKDIR "/src/API.Authentication"
RUN dotnet build "API.Authentication.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "API.Authentication.csproj" -c Release -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "API.Authentication.dll"]

Receiving below error:

Step 14/23 : RUN dotnet restore "API.Authentication/API.Authentication.csproj" ---> Running in 36ddc34cd2a1 Determining projects to restore... C:\src\Shared.Kernel\Shared.Kernel.csproj : error NU1301: Unable to load the service index for source https://api.nuget.org/v3/index.json. [C:\src\API.Authentication\API.Authentication.csproj]

Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant