From 1e4edb6de22e2f12dffa4f6b27b958063353bc34 Mon Sep 17 00:00:00 2001 From: idevakk <219866223+idevakk@users.noreply.github.com> Date: Mon, 9 Mar 2026 23:29:31 +0530 Subject: [PATCH] build: use mlocati/php-extension-installer to speed up docker builds --- Dockerfile | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/Dockerfile b/Dockerfile index c095b13..9618f70 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,36 +23,29 @@ RUN npm run build FROM php:8.4-fpm-alpine WORKDIR /var/www/html +# Install mlocati/php-extension-installer +COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/ + # Install system dependencies RUN apk add --no-cache \ nginx \ supervisor \ - libpng-dev \ - libjpeg-turbo-dev \ - freetype-dev \ - libzip-dev \ - icu-dev \ git \ - $PHPIZE_DEPS \ linux-headers \ openssl-dev # Install PHP extensions -RUN docker-php-ext-configure gd --with-freetype --with-jpeg \ - && docker-php-ext-install -j$(nproc) \ - pdo_mysql \ - gd \ - zip \ - intl \ - bcmath \ - pcntl \ - opcache \ - sockets - -# Install PECL extensions (MongoDB and Redis) -RUN pecl install mongodb redis \ - && docker-php-ext-enable mongodb redis \ - && rm -rf /tmp/pear +RUN install-php-extensions \ + pdo_mysql \ + gd \ + zip \ + intl \ + bcmath \ + pcntl \ + opcache \ + sockets \ + mongodb \ + redis # Copy source code and vendor dependencies COPY . .