Search code examples
phpdockergrpc

Docker container fails to build when installing GRPC


I have a Dockerfile that when used with my docker-compose commands works fine, I'd like to have this docker container built however as GRPC takes 15 mins to install every time I want to run tests in GitHub Actions

This is what my Dockerfile currently looks like:

FROM xxx-base:6

RUN pecl install grpc \
    && docker-php-ext-enable grpc \

WORKDIR /application

And I get the following error output:

#5 580.4 g++: fatal error: Killed signal terminated program cc1plus
#5 580.4 compilation terminated.
#5 580.4 make: *** [Makefile:248: src/core/ext/filters/client_channel/lb_policy/xds/cds.lo] Error 1
#5 580.5 ERROR: `make' failed
------
executor failed running [/bin/sh -c sudo pecl install grpc     && docker-php-ext-enable grpc WORKDIR /application]: exit code: 1

It's worth mentioning in the base container used here I used pecl to install imagik so I know that command at least partially works. This is a base PHP 7.4 container.

Any suggestions, I've seen some other posts referring to the memory limit on the docker build, but I'm not sure what to change

Pastebin full stacktrace: pastebin.com/g7iZ2uRn


Solution

  • Installing GRPC in a pipeline takes a long time. I recommend using the cache of the provider used (bitbucket, github etc ..) or using a base image which is used as the starting point of the Dockerfile

    FROM baseimage:latest
    

    I have implemented an image based on alpine and php 7.4 with extension grpc installed, check it on github gits click here