build: use mlocati/php-extension-installer to speed up docker builds
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled

This commit is contained in:
idevakk
2026-03-09 23:29:31 +05:30
parent 371be069db
commit 1e4edb6de2

View File

@@ -23,23 +23,19 @@ RUN npm run build
FROM php:8.4-fpm-alpine FROM php:8.4-fpm-alpine
WORKDIR /var/www/html 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 # Install system dependencies
RUN apk add --no-cache \ RUN apk add --no-cache \
nginx \ nginx \
supervisor \ supervisor \
libpng-dev \
libjpeg-turbo-dev \
freetype-dev \
libzip-dev \
icu-dev \
git \ git \
$PHPIZE_DEPS \
linux-headers \ linux-headers \
openssl-dev openssl-dev
# Install PHP extensions # Install PHP extensions
RUN docker-php-ext-configure gd --with-freetype --with-jpeg \ RUN install-php-extensions \
&& docker-php-ext-install -j$(nproc) \
pdo_mysql \ pdo_mysql \
gd \ gd \
zip \ zip \
@@ -47,12 +43,9 @@ RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
bcmath \ bcmath \
pcntl \ pcntl \
opcache \ opcache \
sockets sockets \
mongodb \
# Install PECL extensions (MongoDB and Redis) redis
RUN pecl install mongodb redis \
&& docker-php-ext-enable mongodb redis \
&& rm -rf /tmp/pear
# Copy source code and vendor dependencies # Copy source code and vendor dependencies
COPY . . COPY . .