2

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

Lewis Smith
  • 1,271
  • 1
  • 14
  • 39

2 Answers2

2

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

0

In case gcc –version says anything less than 4.9 ...this might be the cause.

This answer also seems to be related to your scenario... in case PECL fails.

Martin Zeitler
  • 1
  • 19
  • 155
  • 216
  • Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1 Apple clang version 12.0.5 (clang-1205.0.22.11) Target: x86_64-apple-darwin20.6.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin Can't tell if that's 4.2 or 12.x – Lewis Smith Sep 10 '21 at 15:36
  • Trying `pecl -d php_suffix=7.4 install grpc` – Lewis Smith Sep 10 '21 at 15:39
  • No Good `#5 6.401 2077 source files, building #5 6.405 running: phpize7.4 #5 6.407 sh: 1: phpize7.4: not found #5 6.410 ERROR: `phpize' failed` – Lewis Smith Sep 10 '21 at 15:41
  • This needs to be installed. I can only speak for Linux, where the package is called `php7.4-dev` or `php7.4-devel` or just `php-devel`. Missing that package might eventually add to the problem (which might eventually even stem from `xxx-base:6` already). When GCC version is less than 4.9, this is only suitable for building elder versions (eg. I can build GPRC on CentOS8, but not on CentOS 7, with GCC 4.8.5). – Martin Zeitler Sep 10 '21 at 15:42
  • I'm not great with Linux, `apt-get install php7.4-devel` throws an error saying it can't find that package, what should the command be. Or is that something I need to go and investigate – Lewis Smith Sep 10 '21 at 15:47
  • On Debian it's `-dev` ...`-devel` is RHEL slang. And are you sure that "configured with" is from inside the container? This seems to be OSX and not exactly Linux. – Martin Zeitler Sep 10 '21 at 15:47
  • The container this is built from depends on `FROM php:7.4-fpm` not sure if that helps – Lewis Smith Sep 10 '21 at 15:50
  • There is one pesky detail about the container itself, or better said, the PHP which ships with it: "If using PHP 7.4+, PHP must have been installed with the `--with-pear` flag." ...if this shouldn't be the case, you'll have to build PHP, to begin with. – Martin Zeitler Sep 10 '21 at 16:06
  • Okay I'll try 7.3 for a test – Lewis Smith Sep 10 '21 at 16:07
  • Different errors, hahaha, okay more investigation required – Lewis Smith Sep 10 '21 at 16:19