Publish a gRPCserver project from Visual studio into Docker Hub repository

132 views Asked by At

I build a gRPC server into Visual studio. This server I debugged by deploying it into a local Docker container. This is working great. For this, I am using following 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"]

Pushing the Docker image in my local repository, which I used for debugging purposes, to a remote repository for deployment doesn't really work. (I already figured that out).

As I am searching still a way to deploy, I tried following link (where I deploy to Docker Hub): https://learn.microsoft.com/en-us/visualstudio/containers/deploy-docker-hub?view=vs-2019

Trying to deploy to Docker hub, makes the compiler stop with the next error:

#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 ==========

I am trying to do pretty default stuff. Cannot believe this is going wrong. Anybody ideas or experience on this matter? Pretty desperate to fall back on manual Docker build.

2

There are 2 answers

0
Дриес Геентйенс On BEST ANSWER

My VPN wasn't configured correctly. I solved this problem closing the VPN temporary.