Skip to content

Commit 015d8d7

Browse files
committed
try again
1 parent 3e48dcb commit 015d8d7

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

Dockerfile

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,34 @@ RUN apt-get update && apt-get install -y \
88
autoconf \
99
libtool \
1010
pkg-config \
11-
re2c
11+
re2c \
12+
# "linux-headers-generic" is sometimes helpful for bleeding edge builds,
13+
# but build-essential usually covers it.
14+
&& apt-get clean
1215

1316
# Download and Compile gRPC (PR #40337)
14-
# We use /tmp/grpc to build
1517
WORKDIR /tmp/grpc
1618
RUN git clone --depth 1 https://github.com/grpc/grpc.git . \
1719
&& git fetch origin pull/40337/head:pr-40337 \
1820
&& git checkout pr-40337 \
1921
&& git submodule update --init --recursive --depth 1 \
2022
&& mkdir -p cmake/build && cd cmake/build \
21-
# Build the C++ Core (Static Lib)
22-
&& cmake ../.. -DCMAKE_BUILD_TYPE=Release -DgRPC_INSTALL=ON -DgRPC_BUILD_TESTS=OFF -DgRPC_PHP_SATELLITE_SERVICES=ON \
23+
# --- BUILD C++ CORE ---
24+
&& cmake ../.. \
25+
-DCMAKE_BUILD_TYPE=Release \
26+
-DgRPC_INSTALL=ON \
27+
-DgRPC_BUILD_TESTS=OFF \
28+
-DgRPC_PHP_SATELLITE_SERVICES=ON \
29+
-DBUILD_SHARED_LIBS=ON \
2330
&& make -j$(nproc) \
2431
&& make install \
2532
&& ldconfig \
26-
# Build the PHP Extension, providing the path to the C++ core libs
33+
# --- BUILD PHP EXT ---
2734
&& cd ../../src/php/ext/grpc \
2835
&& phpize \
29-
&& export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig \
30-
&& CPPFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib" ./configure --with-grpc \
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 \
38+
&& CPPFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib" ./configure --with-grpc=/usr/local \
3139
&& make -j$(nproc) \
3240
&& cp modules/grpc.so /tmp/grpc.so
3341

@@ -46,15 +54,18 @@ RUN apt-get update && apt-get install -y \
4654
libonig-dev \
4755
libxml2-dev \
4856
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++
4960
&& apt-get clean && rm -rf /var/lib/apt/lists/*
5061

51-
# Copy Composer from official image
62+
# Copy Composer
5263
COPY --from=composer:2.8.9 /usr/bin/composer /usr/bin/composer
5364

54-
# Copy install-php-extensions from mlocati
65+
# Copy install-php-extensions
5566
COPY --from=mlocati/php-extension-installer:latest /usr/bin/install-php-extensions /usr/local/bin/
5667

57-
# Install PHP extensions declaratively
68+
# Install PHP extensions
5869
RUN install-php-extensions mysqli \
5970
redis \
6071
pdo_mysql \
@@ -68,7 +79,7 @@ RUN install-php-extensions mysqli \
6879
zip \
6980
pcov
7081

71-
# Copy grpc to a temporary spot first, then move it to the correct dir dynamically
82+
# Copy grpc and enable
7283
COPY --from=builder /tmp/grpc.so /tmp/grpc.so
7384
RUN mv /tmp/grpc.so $(php-config --extension-dir) \
7485
&& docker-php-ext-enable grpc

0 commit comments

Comments
 (0)