FROM library/alpine
RUN apk add gcc autoconf nginx php7-fpm php7-mcrypt php7-pdo php7-pdo_pgsql php7-pear php7-redis php7-dev php7-mbstring php7-bcmath php7-json php7-opcache php7-curl php7-xml php7-simplexml php7-dom php7-tokenizer php7-openssl php7-fileinfo php7-gmp php7-gd php7-zip zip composer git
RUN apk add make g++ m4 automake libtool linux-headers
RUN pecl install protobuf
RUN pecl install grpc

Dockerfile 要这样写,在php.ini里要加

extension=grpc
extension=protobuf

composer.json里要加

"require": {
        "php": "^7.2.5",
        "grpc/grpc": "^v1.3.0",
        "google/protobuf": "^v3.3.0",
    },

你们都懂得