-
Notifications
You must be signed in to change notification settings - Fork 10.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Grpc.Tools generation doesn't work on Alpine Linux (incompatible protoc & grpc_csharp_plugin binaries). #24188
Comments
I am running into the same issue w/ the following versions:
@jtattermusch Any updates (or do you need more info)? Currently using the latest dotnet GRPC is not possible on alpine. |
Same here with Grpc.Tools 2.37.0.
|
I fixed this in my project by replacing usage of image |
The downside of that approach is that you can't use self-contained deployments since it forces you to specify the platform, which in turn must match the platform of the sdk the project was built with. In other words: the flavor of the build base image (e.g. sdk:5.0-alpine) must match the flavor of the runtime image (e.g. runtime-deps:5.0-alpine) for self-contained deployments. Besides, the whole point (at least for me) to use Alpine, is to reduce the size of the resulting image. |
There was originally a workaround for this using: https://github.com/sgerrand/alpine-pkg-glibc That still seems to get the csharp grpc plugin working on alpine |
As a workaround - once #27099 is released (it has been merged) you will be able to use the GRPC_PROTOC_PLUGIN environment variable to point to your own plugin that is built to work on alpine. |
Summary of current workaround for anyone coming across this issue: The binaries shipped in Grpc.Tools currently do not work on alpine linux. However there are binaries that do work and these can be downloaded from: https://pkgs.alpinelinux.org/package/edge/community/x86_64/grpc-plugins So a workaround to use Grpc.Tools on alpine: # install grpc-plugins package to get tools built for Alpine linux
apk add grpc-plugins
# set environment variables for the tools
export PROTOBUF_PROTOC=/usr/bin/protoc
export GRPC_PROTOC_PLUGIN=/usr/bin/grpc_csharp_plugin
# do the .NET build
dotnet build Note: You need Grpc.Tools version 2.50.0 or later for this workaround to work. |
FYI - this workaround is now documented: |
What version of gRPC and what language are you using?
grpc.tools 2.31.0
What operating system (Linux, Windows,...) and version?
Alpine 3.12 (more precisely the mcr.microsoft.com/dotnet/core/sdk:3.1-alpine image)
What runtime / compiler are you using (e.g. python version or version of gcc)
netcoreapp 3.1
What did you do?
When building a dotnet app docker image based on alpine, I got the error reported in #18338. I tried the workaround specified in the issue but changed the grpc.tools version to 2.31.0 (because that is the one shipped with the nuget package), but I got the error mentioned below.
What did you expect to see?
The image to build.
What did you see instead?
The image fails to build with the following error
Anything else we should know about your project / environment?
The only changes from the issue #18338 and this one are the versions :
Either I missed something or the workaround no longer works. If it is the latter, the closing comment of #18338 does not apply anymore. Will there be plans to support alpine if this is the case ?
The text was updated successfully, but these errors were encountered: