1- FROM php:8.3.13 -alpine3.20
1+ FROM php:8.3.9 -alpine3.20
22
3- # Set the maintainer label
43LABEL Maintainer="Kazem Mirzaei <
[email protected] >"
54LABEL Description="PHP-FPM v8.3 with essential extensions and FFmpeg with libfdk-aac support on Alpine Linux."
65
7- # Set environment variables for the user and group
86ENV USER www
97ENV GROUP www
108
11- # Switch to root user to perform system updates and installations
129USER root
1310
14- #############################################
15- ### Install system dependencies and PHP extensions
16- #############################################
17-
11+ # Install runtime and build dependencies
1812RUN set -ex \
19- # Install system dependencies
20- && apk add --update --no-cache \
21- freetype \
22- gettext \
23- gmp \
24- icu-libs \
25- imagemagick \
26- imap \
27- libintl \
28- libjpeg-turbo \
29- libpng \
30- libpq \
31- libtool \
32- libxpm \
33- libxslt \
34- libzip \
35- mysql-client \
36- tzdata \
37- \
38- # Development dependencies
39- && apk add --update --no-cache --virtual .build-deps \
13+ && apk update && apk upgrade \
14+ && apk add --no-cache \
4015 autoconf \
4116 curl-dev \
17+ freetype \
4218 freetype-dev \
4319 g++ \
4420 gcc \
21+ gettext \
4522 gettext-dev \
4623 git \
24+ gmp \
4725 gmp-dev \
26+ icu-libs \
4827 icu-dev \
28+ imagemagick \
4929 imagemagick-dev \
30+ imap \
5031 imap-dev \
5132 krb5-dev \
5233 libc-dev \
34+ libintl \
35+ libjpeg-turbo \
5336 libjpeg-turbo-dev \
37+ libpng \
5438 libpng-dev \
5539 libwebp-dev \
5640 libxml2-dev \
41+ libxpm \
5742 libxpm-dev \
43+ libxslt \
5844 libxslt-dev \
45+ libzip \
5946 libzip-dev \
47+ make \
48+ mysql-client \
6049 pcre-dev \
6150 pkgconf \
62- zlib-dev \
63- nasm \
64- yasm \
65- tar \
66- build-base \
67- fdk-aac-dev \
68- lame-dev \
69- libass-dev \
70- libvpx-dev \
71- libvorbis-dev \
72- libogg-dev \
73- libtheora-dev \
74- opus-dev \
75- \
76- ################################
77- # Install PHP extensions
78- ################################
79- \
80- # Install gd
81- && ln -s /usr/lib/$(apk --print-arch)-linux-gnu/libXpm.* /usr/lib/ \
51+ tzdata \
52+ zlib-dev
53+
54+ # Install PHP extensions
55+ RUN ln -s /usr/lib/$(apk --print-arch)-linux-gnu/libXpm.* /usr/lib/ \
8256 && docker-php-ext-configure gd --with-webp --with-jpeg --with-xpm --with-freetype --enable-gd-jis-conv \
83- && docker-php-ext-install -j$(nproc) gd \
84- \
85- # Install gettext, gmp, bcmath, exif, intl, imap, pdo_mysql, pcntl, zip, redis, imagick
86- && docker-php-ext-install -j$(nproc) gettext gmp bcmath exif intl pdo pdo_mysql pcntl zip \
87- && docker-php-ext-configure imap --with-kerberos --with-imap-ssl \
88- && docker-php-ext-install -j$(nproc) imap \
89- && pecl install imagick redis \
90- && docker-php-ext-enable imagick redis \
91- \
92- # Clean up build packages
93- && docker-php-source delete \
94- && rm -fr /tmp/pear \
95- && rm -rf /var/cache/apk/* \
96- \
97- #############################################
98- ### Install and compile FFmpeg with libfdk-aac
99- #############################################
100- \
101- && mkdir -p /usr/src/ffmpeg \
57+ && docker-php-ext-install -j$(nproc) gd
58+
59+ RUN docker-php-ext-install -j$(nproc) gettext gmp bcmath exif intl pdo pdo_mysql pcntl zip
60+
61+ RUN docker-php-ext-configure imap --with-kerberos --with-imap-ssl \
62+ && docker-php-ext-install -j$(nproc) imap
63+
64+ # Install required libraries for imagick
65+ RUN apk add --no-cache imagemagick imagemagick-dev
66+
67+ # Install imagick and redis extensions separately
68+ RUN pecl install imagick \
69+ && docker-php-ext-enable imagick
70+
71+ RUN pecl install redis \
72+ && docker-php-ext-enable redis
73+
74+ # Compile and install FFmpeg with libfdk-aac support
75+ RUN mkdir -p /usr/src/ffmpeg \
10276 && cd /usr/src/ffmpeg \
10377 && wget https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 \
10478 && tar xjf ffmpeg-snapshot.tar.bz2 \
@@ -118,8 +92,7 @@ RUN set -ex \
11892 && make -j$(nproc) \
11993 && make install \
12094 && cd / \
121- && rm -rf /usr/src/ffmpeg \
122- && apk del .build-deps
95+ && rm -rf /usr/src/ffmpeg
12396
12497# Install Composer
12598RUN wget https://raw.githubusercontent.com/composer/getcomposer.org/76a7060ccb93902cd7576b67264ad91c8a2700e2/web/installer -O - -q | php -- --quiet \
0 commit comments