Skip to content

Commit

Permalink
feat: compile phpredis with igbinary and zstd support
Browse files Browse the repository at this point in the history
  • Loading branch information
carlalexander committed Jun 5, 2021
1 parent b22dfc1 commit 4301b18
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 12 deletions.
15 changes: 14 additions & 1 deletion runtime/base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -437,15 +437,25 @@ RUN set -xe; \
make -j $(nproc); \
make install

###############################################################################
# Redis Build
# https://github.com/phpredis/phpredis/releases
# Needs:
#
# Needed by:
# - php
ENV REDIS_BUILD_DIR=${BUILD_DIR}/redis
ENV VERSION_REDIS_EXTENSION=5.3.4

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

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

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

# Copy zstd shared libs that are not present in amazonlinux2
RUN cp /usr/lib64/libzstd.so.1 /opt/ymir/lib/libzstd.so.1

# Copy ImageMagick shared libs that are not present in amazonlinux2
RUN cp /usr/lib64/libpng15.so.15 /opt/ymir/lib/libpng15.so.15
RUN cp /usr/lib64/libjpeg.so.62 /opt/ymir/lib/libjpeg.so.62
Expand Down
15 changes: 13 additions & 2 deletions runtime/php-72/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,14 @@ RUN set -xe; \

# Install extensions
# We can install extensions manually or using `pecl`
RUN pecl install redis
RUN pecl install APCu
RUN pecl install igbinary
RUN pecl install zstd

# Build extensions
WORKDIR ${IMAGICK_BUILD_DIR}
RUN set -xe; \
pecl download imagick; \
pecl download imagick-${VERSION_IMAGICK_EXTENSION}; \
tar xzf imagick-${VERSION_IMAGICK_EXTENSION}.tgz
WORKDIR ${IMAGICK_BUILD_DIR}/imagick-${VERSION_IMAGICK_EXTENSION}
RUN set -xe; \
Expand All @@ -84,6 +85,16 @@ RUN set -xe; \
make -j $(nproc); \
make install;

WORKDIR ${REDIS_BUILD_DIR}
RUN set -xe; \
pecl download redis-${VERSION_REDIS_EXTENSION}; \
tar xzf redis-${VERSION_REDIS_EXTENSION}.tgz
WORKDIR ${REDIS_BUILD_DIR}/redis-${VERSION_REDIS_EXTENSION}
RUN set -xe; \
phpize; \
./configure --enable-redis-igbinary --enable-redis-zstd; \
make && make install;

# Install Composer
RUN curl -sS https://getcomposer.org/installer | ${INSTALL_DIR}/bin/php -- --install-dir=${INSTALL_DIR}/bin/ --filename=composer

Expand Down
2 changes: 2 additions & 0 deletions runtime/php-72/php.ini
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ opcache.max_accelerated_files=10000
opcache.max_wasted_percentage=10

extension=apcu.so
extension=igbinary.so
extension=imagick.so
extension=intl.so
extension=pdo_mysql.so
extension=redis.so
extension=zstd.so
zend_extension=opcache.so

; This directive determines which super global arrays are registered when PHP
Expand Down
15 changes: 13 additions & 2 deletions runtime/php-73/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,14 @@ RUN set -xe; \

# Install extensions
# We can install extensions manually or using `pecl`
RUN pecl install redis
RUN pecl install APCu
RUN pecl install igbinary
RUN pecl install zstd

# Build extensions
WORKDIR ${IMAGICK_BUILD_DIR}
RUN set -xe; \
pecl download imagick; \
pecl download imagick-${VERSION_IMAGICK_EXTENSION}; \
tar xzf imagick-${VERSION_IMAGICK_EXTENSION}.tgz
WORKDIR ${IMAGICK_BUILD_DIR}/imagick-${VERSION_IMAGICK_EXTENSION}
RUN set -xe; \
Expand All @@ -84,6 +85,16 @@ RUN set -xe; \
make -j $(nproc); \
make install;

WORKDIR ${REDIS_BUILD_DIR}
RUN set -xe; \
pecl download redis-${VERSION_REDIS_EXTENSION}; \
tar xzf redis-${VERSION_REDIS_EXTENSION}.tgz
WORKDIR ${REDIS_BUILD_DIR}/redis-${VERSION_REDIS_EXTENSION}
RUN set -xe; \
phpize; \
./configure --enable-redis-igbinary --enable-redis-zstd; \
make && make install;

# Install Composer
RUN curl -sS https://getcomposer.org/installer | ${INSTALL_DIR}/bin/php -- --install-dir=${INSTALL_DIR}/bin/ --filename=composer

Expand Down
2 changes: 2 additions & 0 deletions runtime/php-73/php.ini
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ opcache.max_accelerated_files=10000
opcache.max_wasted_percentage=10

extension=apcu.so
extension=igbinary.so
extension=imagick.so
extension=intl.so
extension=pdo_mysql.so
extension=redis.so
extension=zstd.so
zend_extension=opcache.so

; This directive determines which super global arrays are registered when PHP
Expand Down
15 changes: 13 additions & 2 deletions runtime/php-74/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,14 @@ RUN set -xe; \
cp php.ini-production ${INSTALL_DIR}/etc/php/php.ini

# Install extensions using pecl
RUN pecl install redis
RUN pecl install APCu
RUN pecl install igbinary
RUN pecl install zstd

# Build extensions
WORKDIR ${IMAGICK_BUILD_DIR}
RUN set -xe; \
pecl download imagick; \
pecl download imagick-${VERSION_IMAGICK_EXTENSION}; \
tar xzf imagick-${VERSION_IMAGICK_EXTENSION}.tgz
WORKDIR ${IMAGICK_BUILD_DIR}/imagick-${VERSION_IMAGICK_EXTENSION}
RUN set -xe; \
Expand All @@ -105,6 +106,16 @@ RUN set -xe; \
make -j $(nproc); \
make install;

WORKDIR ${REDIS_BUILD_DIR}
RUN set -xe; \
pecl download redis-${VERSION_REDIS_EXTENSION}; \
tar xzf redis-${VERSION_REDIS_EXTENSION}.tgz
WORKDIR ${REDIS_BUILD_DIR}/redis-${VERSION_REDIS_EXTENSION}
RUN set -xe; \
phpize; \
./configure --enable-redis-igbinary --enable-redis-zstd; \
make && make install;

# Install Composer
RUN curl -sS https://getcomposer.org/installer | ${INSTALL_DIR}/bin/php -- --install-dir=${INSTALL_DIR}/bin/ --filename=composer

Expand Down
12 changes: 7 additions & 5 deletions runtime/php-74/php.ini
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ opcache.memory_consumption=128
opcache.max_accelerated_files=10000
opcache.max_wasted_percentage=10

extension=apcu
extension=imagick
extension=intl
extension=pdo_mysql
extension=redis
extension=apcu.so
extension=igbinary.so
extension=imagick.so
extension=intl.so
extension=pdo_mysql.so
extension=redis.so
extension=zstd.so
zend_extension=opcache.so

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

0 comments on commit 4301b18

Please sign in to comment.