Skip to content

Commit 4301b18

Browse files
committed
feat: compile phpredis with igbinary and zstd support
1 parent b22dfc1 commit 4301b18

File tree

7 files changed

+64
-12
lines changed

7 files changed

+64
-12
lines changed

runtime/base/Dockerfile

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,15 +437,25 @@ RUN set -xe; \
437437
make -j $(nproc); \
438438
make install
439439

440+
###############################################################################
441+
# Redis Build
442+
# https://github.com/phpredis/phpredis/releases
443+
# Needs:
444+
#
445+
# Needed by:
446+
# - php
447+
ENV REDIS_BUILD_DIR=${BUILD_DIR}/redis
448+
ENV VERSION_REDIS_EXTENSION=5.3.4
440449

441450
# Install some dev files for using old libraries already on the system
442451
# readline-devel : needed for the --with-libedit flag
443452
# gettext-devel : needed for the --with-gettext flag
444453
# libicu-devel : needed for
445454
# libxslt-devel : needed for the XSL extension
455+
# libzstd-devel: needed for PHP Redis
446456
# sqlite-devel : Since PHP 7.4 this must be installed (https://github.com/php/php-src/blob/99b8e67615159fc600a615e1e97f2d1cf18f14cb/UPGRADING#L616-L619)
447457
# re2c : needed for PHP 7.4
448-
RUN LD_LIBRARY_PATH= yum install -y re2c readline-devel gettext-devel libicu-devel libxslt-devel sqlite-devel
458+
RUN LD_LIBRARY_PATH= yum install -y re2c readline-devel gettext-devel libicu-devel libxslt-devel libzstd-devel sqlite-devel
449459

450460
RUN cp -a /usr/lib64/libgcrypt.so* ${INSTALL_DIR}/lib64/
451461

@@ -466,6 +476,9 @@ RUN cp -a /usr/lib64/lib*xslt*.so* ${INSTALL_DIR}/lib64/
466476
# Copy sqlite3 shared libs that are not present in amazonlinux2
467477
RUN cp -a /usr/lib64/libsqlite3*.so* ${INSTALL_DIR}/lib64/
468478

479+
# Copy zstd shared libs that are not present in amazonlinux2
480+
RUN cp /usr/lib64/libzstd.so.1 /opt/ymir/lib/libzstd.so.1
481+
469482
# Copy ImageMagick shared libs that are not present in amazonlinux2
470483
RUN cp /usr/lib64/libpng15.so.15 /opt/ymir/lib/libpng15.so.15
471484
RUN cp /usr/lib64/libjpeg.so.62 /opt/ymir/lib/libjpeg.so.62

runtime/php-72/Dockerfile

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,14 @@ RUN set -xe; \
6969

7070
# Install extensions
7171
# We can install extensions manually or using `pecl`
72-
RUN pecl install redis
7372
RUN pecl install APCu
73+
RUN pecl install igbinary
74+
RUN pecl install zstd
7475

7576
# Build extensions
7677
WORKDIR ${IMAGICK_BUILD_DIR}
7778
RUN set -xe; \
78-
pecl download imagick; \
79+
pecl download imagick-${VERSION_IMAGICK_EXTENSION}; \
7980
tar xzf imagick-${VERSION_IMAGICK_EXTENSION}.tgz
8081
WORKDIR ${IMAGICK_BUILD_DIR}/imagick-${VERSION_IMAGICK_EXTENSION}
8182
RUN set -xe; \
@@ -84,6 +85,16 @@ RUN set -xe; \
8485
make -j $(nproc); \
8586
make install;
8687

88+
WORKDIR ${REDIS_BUILD_DIR}
89+
RUN set -xe; \
90+
pecl download redis-${VERSION_REDIS_EXTENSION}; \
91+
tar xzf redis-${VERSION_REDIS_EXTENSION}.tgz
92+
WORKDIR ${REDIS_BUILD_DIR}/redis-${VERSION_REDIS_EXTENSION}
93+
RUN set -xe; \
94+
phpize; \
95+
./configure --enable-redis-igbinary --enable-redis-zstd; \
96+
make && make install;
97+
8798
# Install Composer
8899
RUN curl -sS https://getcomposer.org/installer | ${INSTALL_DIR}/bin/php -- --install-dir=${INSTALL_DIR}/bin/ --filename=composer
89100

runtime/php-72/php.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ opcache.max_accelerated_files=10000
2020
opcache.max_wasted_percentage=10
2121

2222
extension=apcu.so
23+
extension=igbinary.so
2324
extension=imagick.so
2425
extension=intl.so
2526
extension=pdo_mysql.so
2627
extension=redis.so
28+
extension=zstd.so
2729
zend_extension=opcache.so
2830

2931
; This directive determines which super global arrays are registered when PHP

runtime/php-73/Dockerfile

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,14 @@ RUN set -xe; \
6969

7070
# Install extensions
7171
# We can install extensions manually or using `pecl`
72-
RUN pecl install redis
7372
RUN pecl install APCu
73+
RUN pecl install igbinary
74+
RUN pecl install zstd
7475

7576
# Build extensions
7677
WORKDIR ${IMAGICK_BUILD_DIR}
7778
RUN set -xe; \
78-
pecl download imagick; \
79+
pecl download imagick-${VERSION_IMAGICK_EXTENSION}; \
7980
tar xzf imagick-${VERSION_IMAGICK_EXTENSION}.tgz
8081
WORKDIR ${IMAGICK_BUILD_DIR}/imagick-${VERSION_IMAGICK_EXTENSION}
8182
RUN set -xe; \
@@ -84,6 +85,16 @@ RUN set -xe; \
8485
make -j $(nproc); \
8586
make install;
8687

88+
WORKDIR ${REDIS_BUILD_DIR}
89+
RUN set -xe; \
90+
pecl download redis-${VERSION_REDIS_EXTENSION}; \
91+
tar xzf redis-${VERSION_REDIS_EXTENSION}.tgz
92+
WORKDIR ${REDIS_BUILD_DIR}/redis-${VERSION_REDIS_EXTENSION}
93+
RUN set -xe; \
94+
phpize; \
95+
./configure --enable-redis-igbinary --enable-redis-zstd; \
96+
make && make install;
97+
8798
# Install Composer
8899
RUN curl -sS https://getcomposer.org/installer | ${INSTALL_DIR}/bin/php -- --install-dir=${INSTALL_DIR}/bin/ --filename=composer
89100

runtime/php-73/php.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ opcache.max_accelerated_files=10000
2020
opcache.max_wasted_percentage=10
2121

2222
extension=apcu.so
23+
extension=igbinary.so
2324
extension=imagick.so
2425
extension=intl.so
2526
extension=pdo_mysql.so
2627
extension=redis.so
28+
extension=zstd.so
2729
zend_extension=opcache.so
2830

2931
; This directive determines which super global arrays are registered when PHP

runtime/php-74/Dockerfile

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,14 @@ RUN set -xe; \
9090
cp php.ini-production ${INSTALL_DIR}/etc/php/php.ini
9191

9292
# Install extensions using pecl
93-
RUN pecl install redis
9493
RUN pecl install APCu
94+
RUN pecl install igbinary
95+
RUN pecl install zstd
9596

9697
# Build extensions
9798
WORKDIR ${IMAGICK_BUILD_DIR}
9899
RUN set -xe; \
99-
pecl download imagick; \
100+
pecl download imagick-${VERSION_IMAGICK_EXTENSION}; \
100101
tar xzf imagick-${VERSION_IMAGICK_EXTENSION}.tgz
101102
WORKDIR ${IMAGICK_BUILD_DIR}/imagick-${VERSION_IMAGICK_EXTENSION}
102103
RUN set -xe; \
@@ -105,6 +106,16 @@ RUN set -xe; \
105106
make -j $(nproc); \
106107
make install;
107108

109+
WORKDIR ${REDIS_BUILD_DIR}
110+
RUN set -xe; \
111+
pecl download redis-${VERSION_REDIS_EXTENSION}; \
112+
tar xzf redis-${VERSION_REDIS_EXTENSION}.tgz
113+
WORKDIR ${REDIS_BUILD_DIR}/redis-${VERSION_REDIS_EXTENSION}
114+
RUN set -xe; \
115+
phpize; \
116+
./configure --enable-redis-igbinary --enable-redis-zstd; \
117+
make && make install;
118+
108119
# Install Composer
109120
RUN curl -sS https://getcomposer.org/installer | ${INSTALL_DIR}/bin/php -- --install-dir=${INSTALL_DIR}/bin/ --filename=composer
110121

runtime/php-74/php.ini

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@ opcache.memory_consumption=128
2424
opcache.max_accelerated_files=10000
2525
opcache.max_wasted_percentage=10
2626

27-
extension=apcu
28-
extension=imagick
29-
extension=intl
30-
extension=pdo_mysql
31-
extension=redis
27+
extension=apcu.so
28+
extension=igbinary.so
29+
extension=imagick.so
30+
extension=intl.so
31+
extension=pdo_mysql.so
32+
extension=redis.so
33+
extension=zstd.so
3234
zend_extension=opcache.so
3335

3436
; This directive determines which super global arrays are registered when PHP

0 commit comments

Comments
 (0)