Skip to content

Commit

Permalink
Add dotnet restore steps to grpc/c# v1.65.1 and pb/c# v27.0 (#1436)
Browse files Browse the repository at this point in the history
Based on #1429.
  • Loading branch information
stefanvanburen authored Aug 20, 2024
1 parent cf5d7ad commit ee5b9b7
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 1 deletion.
1 change: 1 addition & 0 deletions plugins/grpc/csharp/v1.65.1/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*
!Dockerfile
!build.csproj
6 changes: 6 additions & 0 deletions plugins/grpc/csharp/v1.65.1/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,16 @@ WORKDIR /build/grpc
RUN bazel build //src/compiler:grpc_plugin_support
RUN bazel build //src/compiler:grpc_csharp_plugin.stripped

FROM mcr.microsoft.com/dotnet/sdk:8.0.401-bookworm-slim@sha256:8c6beed050a602970c3d275756ed3c19065e42ce6ca0809f5a6fcbf5d36fd305 AS dotnetrestore
WORKDIR /build
COPY --link ./build.csproj /build/build.csproj
RUN mkdir /nuget && dotnet restore --packages /nuget

FROM gcr.io/distroless/cc-debian12:latest@sha256:3b75fdd33932d16e53a461277becf57c4f815c6cee5f6bc8f52457c095e004c8 AS base

FROM scratch
COPY --link --from=base / /
COPY --link --from=dotnetrestore /nuget /nuget
COPY --link --from=build --chmod=0755 /build/grpc/bazel-bin/src/compiler/grpc_csharp_plugin .
USER nobody
ENTRYPOINT ["/grpc_csharp_plugin"]
1 change: 0 additions & 1 deletion plugins/grpc/csharp/v1.65.1/buf.plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@ registry:
deps:
- name: Grpc.Net.Common
version: 2.63.0

9 changes: 9 additions & 0 deletions plugins/grpc/csharp/v1.65.1/build.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Grpc.Net.Common" Version="2.63.0" />
<PackageReference Include="Google.Protobuf" Version="3.26.1" />
</ItemGroup>
</Project>
1 change: 1 addition & 0 deletions plugins/protocolbuffers/csharp/v27.0/.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
!BUILD
!csharp.cc
!Dockerfile
!build.csproj
6 changes: 6 additions & 0 deletions plugins/protocolbuffers/csharp/v27.0/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,16 @@ RUN bazel build '//:protoc_lib'
COPY --link BUILD csharp.cc plugins/
RUN bazel build '//plugins:protoc-gen-csharp.stripped'

FROM mcr.microsoft.com/dotnet/sdk:8.0.401-bookworm-slim@sha256:8c6beed050a602970c3d275756ed3c19065e42ce6ca0809f5a6fcbf5d36fd305 AS dotnetrestore
WORKDIR /build
COPY --link ./build.csproj /build/build.csproj
RUN mkdir /nuget && dotnet restore --packages /nuget

FROM gcr.io/distroless/cc-debian12:latest@sha256:e1065a1d58800a7294f74e67c32ec4146d09d6cbe471c1fa7ed456b2d2bf06e0 AS base

FROM scratch
COPY --from=base --link / /
COPY --link --from=dotnetrestore /nuget /nuget
COPY --from=build --link --chmod=0755 /build/bazel-bin/plugins/protoc-gen-csharp .
USER nobody
ENTRYPOINT ["/protoc-gen-csharp"]
8 changes: 8 additions & 0 deletions plugins/protocolbuffers/csharp/v27.0/build.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard1.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.27.0" />
</ItemGroup>
</Project>

0 comments on commit ee5b9b7

Please sign in to comment.