build: use mlocati/php-extension-installer to speed up docker builds
This commit is contained in:
21
Dockerfile
21
Dockerfile
@@ -23,23 +23,19 @@ 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) \
|
||||
RUN install-php-extensions \
|
||||
pdo_mysql \
|
||||
gd \
|
||||
zip \
|
||||
@@ -47,12 +43,9 @@ RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
|
||||
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
|
||||
sockets \
|
||||
mongodb \
|
||||
redis
|
||||
|
||||
# Copy source code and vendor dependencies
|
||||
COPY . .
|
||||
|
||||
Reference in New Issue
Block a user