Skip to content

Commit 8e56a47

Browse files
committed
compiling grpc from patched source
1 parent 1a63d4b commit 8e56a47

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

Dockerfile

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ RUN apt-get update && apt-get install -y \
1313
libonig-dev \
1414
libxml2-dev \
1515
default-mysql-client \
16+
cmake \
17+
build-essential \
18+
autoconf \
19+
libtool \
20+
pkg-config \
1621
&& apt-get clean \
1722
&& rm -rf /var/lib/apt/lists/*
1823

@@ -35,5 +40,28 @@ RUN install-php-extensions \
3540
xsl \
3641
soap \
3742
zip \
38-
grpc \
3943
pcov
44+
45+
# Manually Build gRPC from PR #40337
46+
# This creates a temporary directory, clones the repo, fetches the specific PR,
47+
# builds the C++ core, then builds the PHP extension, and finally cleans up.
48+
RUN mkdir -p /tmp/grpc-build && cd /tmp/grpc-build \
49+
&& git clone https://github.com/grpc/grpc.git . \
50+
&& git fetch origin pull/40337/head:pr-40337 \
51+
&& git checkout pr-40337 \
52+
&& git submodule update --init --recursive \
53+
# Build and install the gRPC C++ Core libraries first
54+
&& mkdir -p cmake/build && cd cmake/build \
55+
&& cmake ../.. -DgRPC_INSTALL=ON -DgRPC_BUILD_TESTS=OFF \
56+
&& make -j$(nproc) \
57+
&& make install \
58+
# Now build the PHP extension referencing the core libs
59+
&& cd ../../src/php/ext/grpc \
60+
&& phpize \
61+
&& ./configure \
62+
&& make -j$(nproc) \
63+
&& make install \
64+
# Enable the extension
65+
&& docker-php-ext-enable grpc \
66+
# Cleanup source files to reduce image size
67+
&& cd / && rm -rf /tmp/grpc-build

0 commit comments

Comments
 (0)