微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

将 gRPCserver 项目从 Visual Studio 发布到 Docker Hub 存储库

如何解决将 gRPCserver 项目从 Visual Studio 发布到 Docker Hub 存储库

我在 Visual Studio 中构建了一个 gRPC 服务器。我通过将它部署到本地 Docker 容器来调试该服务器。这很好用。为此,我使用以下 Dockerfile:

#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim AS base
workdir /app
EXPOSE 80
#EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim AS build
workdir /src
copY ["GrpcServer/GrpcServer.csproj","GrpcServer/"]
RUN dotnet restore "GrpcServer/GrpcServer.csproj"
copY . .
workdir "/src/GrpcServer"
RUN dotnet build "GrpcServer.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "GrpcServer.csproj" -c Release -o /app/publish

FROM base AS final
workdir /app
copY --from=publish /app/publish .
ENTRYPOINT ["dotnet","GrpcServer.dll"]

将我用于调试目的的本地存储库中的 Docker 映像推送到远程存储库进行部署实际上并不奏效。 (我已经想通了)。

由于我仍在寻找一种部署方式,因此我尝试了以下链接(我部署到 Docker Hub 的位置): https://docs.microsoft.com/en-us/visualstudio/containers/deploy-docker-hub?view=vs-2019

尝试部署到 Docker 集线器,使编译器停止并出现下一个错误

#12 34.06 /src/GrpcServer/GrpcServer.csproj : error NU3037: Package 'System.Diagnostics.DiagnosticSource 4.5.1' from source 'https://api.nuget.org/v3/index.json': The author primary signature validity period has expired.
#12 34.06 /src/GrpcServer/GrpcServer.csproj : error NU3028: Package 'System.Diagnostics.DiagnosticSource 4.5.1' from source 'https://api.nuget.org/v3/index.json': The repository countersignature's timestamp found a chain building issue: UntrustedRoot: self signed certificate in certificate chain
#12 34.07 /src/GrpcServer/GrpcServer.csproj : error NU3028: Package 'Microsoft.Extensions.Http 3.0.3' from source 'https://api.nuget.org/v3/index.json': The author primary signature's timestamp found a chain building issue: UntrustedRoot: self signed certificate in certificate chain
#12 34.07 /src/GrpcServer/GrpcServer.csproj : error NU3037: Package 'Microsoft.Extensions.Http 3.0.3' from source 'https://api.nuget.org/v3/index.json': The author primary signature validity period has expired.
#12 34.08 /src/GrpcServer/GrpcServer.csproj : error NU3028: Package 'Microsoft.Extensions.Http 3.0.3' from source 'https://api.nuget.org/v3/index.json': The repository countersignature's timestamp found a chain building issue: UntrustedRoot: self signed certificate in certificate chain
#12 34.18   Failed to restore /src/GrpcServer/GrpcServer.csproj (in 32.65 sec).
#12 ERROR: executor Failed running [/bin/sh -c dotnet restore "GrpcServer/GrpcServer.csproj"]: exit code: 1
------
 > [build 4/7] RUN dotnet restore "GrpcServer/GrpcServer.csproj":
------
executor Failed running [/bin/sh -c dotnet restore "GrpcServer/GrpcServer.csproj"]: exit code: 1
2>Build Failed. Check the Output window for more details.
========== Build: 1 succeeded,0 Failed,0 up-to-date,0 skipped ==========
========== Publish: 0 succeeded,1 Failed,0 skipped ==========

我正在尝试做一些非常认的事情。不敢相信这会出错。有人对此事有想法或经验吗?非常不顾一切地依赖手动 Docker 构建。

解决方法

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。