Skip to content

Commit b283599

Browse files
authored
[php] Fix #9021 fail to build grpc (#9032)
* Fix #9021 fail to build grpc * Add OPCache, JIT, clean dockerfile * Move Pecl build up for faster local builds when only change the code
1 parent 824494d commit b283599

File tree

3 files changed

+19
-33
lines changed

3 files changed

+19
-33
lines changed

frameworks/PHP/spiral/php/install-composer.sh

Lines changed: 0 additions & 17 deletions
This file was deleted.

frameworks/PHP/spiral/php/php.ini

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1909,6 +1909,11 @@ opcache.huge_code_pages=1
19091909
; SSL stream context option.
19101910
;openssl.capath=
19111911

1912+
1913+
1914+
opcache.jit_buffer_size=128M
1915+
opcache.jit=tracing
1916+
19121917
; Local Variables:
19131918
; tab-width: 4
19141919
; End:

frameworks/PHP/spiral/spiral.dockerfile

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,24 @@
11
FROM php:8.3-cli
22

3-
RUN docker-php-ext-install pdo_mysql > /dev/null
3+
RUN apt-get update -yqq > /dev/null && apt-get install -yqq git unzip > /dev/null
4+
COPY --from=composer/composer:latest-bin --link /composer /usr/local/bin/composer
45

5-
# Workaround solution for installing ext-sockets for PHP 8.0
6-
# See https://github.com/docker-library/php/issues/1245
7-
RUN CFLAGS="$CFLAGS -D_GNU_SOURCE" docker-php-ext-install sockets > /dev/null
6+
RUN docker-php-ext-install \
7+
opcache \
8+
pdo_mysql \
9+
sockets > /dev/null
10+
11+
# RoadRunner >= 2024.x.x requires protobuf extensions to be installed
12+
ARG PROTOBUF_VERSION="4.26.1"
13+
RUN pecl channel-update pecl.php.net
14+
RUN MAKEFLAGS="-j $(nproc)" pecl install protobuf-${PROTOBUF_VERSION} > /dev/null
815

9-
ADD ./ /spiral
1016
WORKDIR /spiral
17+
COPY --link . .
1118

1219
# composer and opcache settings
13-
COPY php/* /usr/local/etc/php/
14-
RUN chmod +x /usr/local/etc/php/install-composer.sh && /usr/local/etc/php/install-composer.sh
15-
16-
# install dependencies
17-
RUN apt-get update -yqq > /dev/null && apt-get install -yqq git unzip > /dev/null
18-
RUN php composer.phar install --optimize-autoloader --classmap-authoritative --no-dev
19-
20-
# RoadRunner >= 2024.x.x requires protobuf and grpc extensions to be installed
21-
ARG PROTOBUF_VERSION="4.26.1"
22-
RUN pecl channel-update pecl.php.net
23-
RUN MAKEFLAGS="-j $(nproc)" pecl install protobuf-${PROTOBUF_VERSION} grpc
20+
COPY --link php/php.ini /usr/local/etc/php/
21+
RUN composer install --optimize-autoloader --classmap-authoritative --no-dev --quiet
2422

2523
# pre-configure
2624
RUN ./vendor/bin/rr get-binary > /dev/null 2>&1

0 commit comments

Comments
 (0)