Skip to content

Commit 1034c2e

Browse files
committed
try again
1 parent 015d8d7 commit 1034c2e

File tree

1 file changed

+17
-24
lines changed

1 file changed

+17
-24
lines changed

Dockerfile

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ RUN apt-get update && apt-get install -y \
99
libtool \
1010
pkg-config \
1111
re2c \
12-
# "linux-headers-generic" is sometimes helpful for bleeding edge builds,
13-
# but build-essential usually covers it.
1412
&& apt-get clean
1513

1614
# Download and Compile gRPC (PR #40337)
@@ -20,7 +18,6 @@ RUN git clone --depth 1 https://github.com/grpc/grpc.git . \
2018
&& git checkout pr-40337 \
2119
&& git submodule update --init --recursive --depth 1 \
2220
&& mkdir -p cmake/build && cd cmake/build \
23-
# --- BUILD C++ CORE ---
2421
&& cmake ../.. \
2522
-DCMAKE_BUILD_TYPE=Release \
2623
-DgRPC_INSTALL=ON \
@@ -30,11 +27,9 @@ RUN git clone --depth 1 https://github.com/grpc/grpc.git . \
3027
&& make -j$(nproc) \
3128
&& make install \
3229
&& ldconfig \
33-
# --- BUILD PHP EXT ---
3430
&& cd ../../src/php/ext/grpc \
3531
&& phpize \
36-
# Ensure PKG_CONFIG_PATH looks in both lib and lib64 just in case
37-
&& export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig \
32+
&& export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig \
3833
&& CPPFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib" ./configure --with-grpc=/usr/local \
3934
&& make -j$(nproc) \
4035
&& cp modules/grpc.so /tmp/grpc.so
@@ -54,9 +49,6 @@ RUN apt-get update && apt-get install -y \
5449
libonig-dev \
5550
libxml2-dev \
5651
default-mysql-client \
57-
# Runtime shared libraries for gRPC might be needed here depending on linking
58-
# but usually the static extension approach is preferred in Docker.
59-
# However, since we built shared upstream, we might need libstdc++
6052
&& apt-get clean && rm -rf /var/lib/apt/lists/*
6153

6254
# Copy Composer
@@ -65,22 +57,23 @@ COPY --from=composer:2.8.9 /usr/bin/composer /usr/bin/composer
6557
# Copy install-php-extensions
6658
COPY --from=mlocati/php-extension-installer:latest /usr/bin/install-php-extensions /usr/local/bin/
6759

68-
# Install PHP extensions
69-
RUN install-php-extensions mysqli \
70-
redis \
71-
pdo_mysql \
72-
pdo_pgsql \
73-
fileinfo \
74-
intl \
75-
sockets \
76-
bcmath \
77-
xsl \
78-
soap \
79-
zip \
80-
pcov
60+
# Install standard extensions
61+
RUN install-php-extensions mysqli redis pdo_mysql pdo_pgsql fileinfo intl sockets bcmath xsl soap zip pcov
62+
63+
64+
# The extension needs these .so files at runtime!
65+
COPY --from=builder /usr/local/lib/libgrpc*.so* /usr/local/lib/
66+
COPY --from=builder /usr/local/lib/libgpr*.so* /usr/local/lib/
67+
COPY --from=builder /usr/local/lib/libabsl*.so* /usr/local/lib/
68+
COPY --from=builder /usr/local/lib/libre2*.so* /usr/local/lib/
69+
COPY --from=builder /usr/local/lib/libaddress_sorting*.so* /usr/local/lib/
70+
# (Optional: Copying the whole /usr/local/lib is often easier if the builder is clean)
71+
# COPY --from=builder /usr/local/lib /usr/local/lib
8172

82-
# Copy grpc and enable
73+
# Update the linker cache so PHP can find the new libraries
74+
RUN ldconfig
75+
76+
# Install the extension
8377
COPY --from=builder /tmp/grpc.so /tmp/grpc.so
8478
RUN mv /tmp/grpc.so $(php-config --extension-dir) \
8579
&& docker-php-ext-enable grpc
86-

0 commit comments

Comments
 (0)