Dot-Net

作者主簽名的時間戳發現了一個建鏈問題:UntrustedRoot: self-signed certificate …

  • January 27, 2021

在我的 .NET Core 項目上進行 docker 建構時,我的所有 NuGet 都出現以下錯誤:

80.19 /app/GradingTool.Tests/GradingTool.Tests.csproj:錯誤 NU3028:來自源“https://api.nuget.org/v3/index.json”的包“Microsoft.EntityFrameworkCore 5.0.0”:作者主簽名的時間戳發現鏈建構問題:UntrustedRoot:證書鏈中的自簽名證書 [/app/GradingTool.sln]

#12 80.20 /app/GradingTool.Tests/GradingTool.Tests.csproj:錯誤 NU3037:來自源“https://api.nuget.org/v3/index.json”的包“Microsoft.EntityFrameworkCore 5.0.0”:作者主簽名有效期已過。[/app/GradingTool.sln]

#12 80.20 /app/GradingTool.Tests/GradingTool.Tests.csproj:錯誤 NU3028:來自源“https://api.nuget.org/v3/index.json”的包“Microsoft.EntityFrameworkCore 5.0.0”:儲存庫會籤的時間戳發現鏈建構問題:UntrustedRoot:證書鏈中的自簽名證書 [/app/GradingTool.sln]

我以前從來沒有遇到過這個錯誤,有人可以幫我找出問題所在嗎?

Dockerfile:

FROM mcr.microsoft.com/dotnet/sdk:latest AS build-env
WORKDIR /app
RUN apt-get update -yq \
   && apt-get install curl gnupg -yq \
   && curl -sL https://deb.nodesource.com/setup_10.x | bash \
   && apt-get install nodejs -yq
# Copy csproj and restore as distinct layers
COPY . ./
RUN dotnet restore
RUN dotnet publish -c Release -o out

# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:latest
RUN apt-get update \
   && apt-get install -y --no-install-recommends libgdiplus libc6-dev \
   && apt-get clean \
   && rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=build-env /app/out .
ENV ASPNETCORE_URLS="http://+:4200"
ENV ASPNETCORE_ENVIRONMENT="Production"
ENV GOOGLE_APPLICATION_CREDENTIALS="Credentials/SchoolTools-e9f260bdf56e.json"
ENV VIRTUAL_HOST="eva.schooltools.lu,www.eva.schooltools.lu,schooltools.lu,www.schooltools.lu"
ENV LETSENCRYPT_HOST="eva.schooltools.lu,www.eva.schooltools.lu,schooltools.lu,www.schooltools.lu"
ENV LETSENCRYPT_EMAIL="wilson.silva@edutec.lu"
EXPOSE 4200
ENTRYPOINT ["dotnet", "GradingTool.dll"]

在 Dockerfile 文件中,我從

FROM mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim

FROM mcr.microsoft.com/dotnet/sdk:5.0-alpine

這對我有用!

更新:查看此公告:https ://github.com/NuGet/Announcements/issues/49

目前,該問題似乎與 Debian 映像有關。

改用基於 Ubuntu 或 Alpine 的映像:

FROM mcr.microsoft.com/dotnet/sdk:5.0-focal AS build-env

關注<https://github.com/NuGet/Home/issues/10491>獲取更新。

引用自:https://stackoverflow.com/questions/65919460