From 064cf19003384e2c53ce567d9ba48067cc4098e0 Mon Sep 17 00:00:00 2001 From: Mateusz Wojczal Date: Thu, 18 Jan 2024 11:51:10 +0100 Subject: [PATCH] optimalisation --- Dockerfile | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) diff --git a/Dockerfile b/Dockerfile index 528f24c..f951e90 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,6 +30,99 @@ RUN set -eux \ && (find /usr/local/lib -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) \ && (find /usr/local/sbin -type f -print0 | xargs -n1 -0 -P$(getconf _NPROCESSORS_ONLN) strip --strip-all -p 2>/dev/null || true) +# -------------------- Installing PHP Extension: gd -------------------- +RUN set -eux \ + # Generic pre-command + && ln -s /usr/lib/$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)/libXpm.* /usr/lib/ \ + # Installation: Version specific + # Type: Built-in extension + # Custom: configure command + && docker-php-ext-configure gd --enable-gd --with-webp --with-jpeg --with-xpm --with-freetype --with-avif \ + # Installation + && docker-php-ext-install -j$(getconf _NPROCESSORS_ONLN) gd \ + && true + +# -------------------- Installing PHP Extension: opcache -------------------- +RUN set -eux \ + # Version specific pre-command + && curl -sS https://raw.githubusercontent.com/php/php-src/php-8.0.6/ext/opcache/Optimizer/zend_dfg.h > /usr/local/include/php/Zend/Optimizer/zend_dfg.h \ + # Installation: Version specific + # Type: Built-in extension + # Installation + && docker-php-ext-install -j$(getconf _NPROCESSORS_ONLN) opcache \ + && true + +# -------------------- Installing PHP Extension: redis -------------------- +RUN set -eux \ + # Generic pre-command + && if [ -f /usr/include/liblzf/lzf.h ]; then \ + ln -s /usr/include/liblzf/lzf.h /usr/include/; \ + fi \ + \ + # Installation: Generic + # Type: GIT extension + && git clone https://github.com/phpredis/phpredis /tmp/redis \ + && cd /tmp/redis \ + # Custom: Branch + && git checkout $(git tag | grep -E '^[.0-9]+$' | sort -V | tail -1) \ + # Custom: Install command + && REDIS_ARGS=""; \ + if php -m | grep -q "igbinary"; then \ + REDIS_ARGS="${REDIS_ARGS} --enable-redis-igbinary"; \ + fi; \ + if php -m | grep -q "lz4"; then \ + REDIS_ARGS="${REDIS_ARGS} --enable-redis-lz4 --with-liblz4=/usr"; \ + fi; \ + if php -m | grep -q "lzf"; then \ + REDIS_ARGS="${REDIS_ARGS} --enable-redis-lzf --with-liblzf=/usr"; \ + fi; \ + if php -m | grep -q "msgpack"; then \ + REDIS_ARGS="${REDIS_ARGS} --enable-redis-msgpack"; \ + fi; \ + if php -m | grep -q "zstd"; then \ + REDIS_ARGS="${REDIS_ARGS} --enable-redis-zstd"; \ + fi; \ + phpize \ + && ./configure --enable-redis ${REDIS_ARGS} \ + && make -j$(getconf _NPROCESSORS_ONLN) \ + && make install \ + \ + # Enabling + && docker-php-ext-enable redis \ + && true + +# -------------------- Installing PHP Extension: pdo_pgsql -------------------- +RUN set -eux \ + # Installation: Generic + # Type: Built-in extension + && docker-php-ext-install -j$(getconf _NPROCESSORS_ONLN) pdo_pgsql \ + && true + +# -------------------- Installing PHP Extension: pgsql -------------------- +RUN set -eux \ + # Installation: Generic + # Type: Built-in extension + && docker-php-ext-install -j$(getconf _NPROCESSORS_ONLN) pgsql \ + && true + +# -------------------- Installing PHP Extension: sodium -------------------- +RUN set -eux \ + # Installation: Generic + # Type: Built-in extension + && docker-php-ext-install -j$(getconf _NPROCESSORS_ONLN) sodium \ + && true + + +# -------------------- Installing PHP Extension: zip -------------------- +RUN set -eux \ + # Installation: Generic + # Type: Built-in extension + # Custom: configure command + && docker-php-ext-configure zip --with-zip \ + && docker-php-ext-install -j$(getconf _NPROCESSORS_ONLN) zip \ + && true + + # composer RUN curl --silent --show-error https://getcomposer.org/composer.phar > composer.phar \ && mv composer.phar /usr/bin/composer