需要在Dockerfile中增加配置参数:ENV DOTNET_NUGET_SIGNATURE_VERIFICATION=false
修改后的Dockerfile如下所示:
FROM 1mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["PortalSiteItemStoreApi/PortalSiteItemStoreApi.csproj", "PortalSiteItemStoreApi/"]
COPY ["Common/Common.csproj", "Common/"]
ENV DOTNET_NUGET_SIGNATURE_VERIFICATION=false
RUN dotnet nuget remove source nuget.org
RUN dotnet nuget add source http://xxx/repository/nuget-group/index.json -n local && \
dotnet restore "Common/Common.csproj" && \
dotnet restore "PortalSiteItemStoreApi/PortalSiteItemStoreApi.csproj"
COPY . .
WORKDIR "/src/PortalSiteItemStoreApi"
RUN dotnet build "./PortalSiteItemStoreApi.csproj" -c $BUILD_CONFIGURATION -o /app/build