1- FROM php:8.5-cli AS builder
2-
3- # Install strictly what is needed to COMPILE gRPC
4- RUN apt-get update && apt-get install -y \
5- git \
6- cmake \
7- build-essential \
8- autoconf \
9- libtool \
10- pkg-config \
11- re2c \
12- && apt-get clean
13-
14- # Download and Compile gRPC (PR #40337)
15- WORKDIR /tmp/grpc
16- RUN git clone --depth 1 https://github.com/grpc/grpc.git . \
17- && git fetch origin pull/40337/head:pr-40337 \
18- && git checkout pr-40337 \
19- && git submodule update --init --recursive --depth 1 \
20- && mkdir -p cmake/build && cd cmake/build \
21- && cmake ../.. \
22- -DCMAKE_BUILD_TYPE=Release \
23- -DgRPC_INSTALL=ON \
24- -DgRPC_BUILD_TESTS=OFF \
25- -DgRPC_PHP_SATELLITE_SERVICES=ON \
26- -DBUILD_SHARED_LIBS=ON \
27- && make -j$(nproc) \
28- && make install \
29- && ldconfig \
30- && cd ../../src/php/ext/grpc \
31- && phpize \
32- && export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig \
33- && CPPFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib" ./configure --with-grpc=/usr/local \
34- && make -j$(nproc) \
35- && cp modules/grpc.so /tmp/grpc.so
36-
37- FROM php:8.5-cli
1+ FROM clegginabox/php-grpc:8.5-cli
382
393# Standard Environment Setup
404ENV COMPOSER_ALLOW_SUPERUSER=1
@@ -59,14 +23,3 @@ COPY --from=mlocati/php-extension-installer:latest /usr/bin/install-php-extensio
5923
6024# Install standard extensions
6125RUN install-php-extensions mysqli redis pdo_mysql pdo_pgsql fileinfo intl sockets bcmath xsl soap zip pcov
62-
63- # Copy ALL shared libraries from the builder to runtime
64- COPY --from=builder /usr/local/lib/ /usr/local/lib/
65-
66- # Update the linker cache so PHP can find the new libraries
67- RUN ldconfig
68-
69- # Install the extension
70- COPY --from=builder /tmp/grpc.so /tmp/grpc.so
71- RUN mv /tmp/grpc.so $(php-config --extension-dir) \
72- && docker-php-ext-enable grpc
0 commit comments