build: use mlocati/php-extension-installer to speed up docker builds
This commit is contained in:
35
Dockerfile
35
Dockerfile
@@ -23,36 +23,29 @@ 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 \
|
intl \
|
||||||
intl \
|
bcmath \
|
||||||
bcmath \
|
pcntl \
|
||||||
pcntl \
|
opcache \
|
||||||
opcache \
|
sockets \
|
||||||
sockets
|
mongodb \
|
||||||
|
redis
|
||||||
# Install PECL extensions (MongoDB and 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 . .
|
||||||
|
|||||||
Reference in New Issue
Block a user