0% found this document useful (0 votes)
53 views3 pages

FROM PHP FPM Alpine3 20

This Dockerfile sets up a PHP environment using the Alpine 3.20 base image, installing necessary packages and PHP extensions, including Xdebug and Imagick. It also configures Composer for dependency management and sets up a working directory for the application. Finally, it includes scripts for running the application and sets the command to execute upon container start.

Uploaded by

Sudhanshu Saxena
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views3 pages

FROM PHP FPM Alpine3 20

This Dockerfile sets up a PHP environment using the Alpine 3.20 base image, installing necessary packages and PHP extensions, including Xdebug and Imagick. It also configures Composer for dependency management and sets up a working directory for the application. Finally, it includes scripts for running the application and sets the command to execute upon container start.

Uploaded by

Sudhanshu Saxena
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

FROM php:fpm-alpine3.

20

RUN apk update && apk add --no-cache \


build-base shadow vim curl autoconf \
npm \
bash \
openssh \
supervisor \
nano \
redis \
icu-dev \
libgcc \
libpng-dev \
libzip-dev \
libpng-dev \
freetype-dev \
libjpeg-turbo-dev \
gd imagemagick \
pngquant \
php \
php-fpm \
php-common \
php-pdo \
php-pdo_mysql \
php-mysqli \
php-intl \
php-xml \
php-openssl \
php-json \
php-phar \
php-redis \
php-dom \
php-session \
python3-dev \
python3 \
rsync \
&& pip install awscli \
&& docker-php-ext-configure opcache --enable-opcache \
&& docker-php-ext-configure intl \
&& docker-php-ext-install fileinfo exif pdo pdo_mysql opcache pcntl intl \
&& docker-php-ext-enable pdo_mysql

RUN pecl install xdebug-3.1.6

RUN docker-php-ext-configure gd --with-freetype --with-jpeg

RUN docker-php-ext-install gd

RUN set -ex \


&& apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS imagemagick-dev
libtool \
&& export CFLAGS="$PHP_CFLAGS" CPPFLAGS="$PHP_CPPFLAGS"
LDFLAGS="$PHP_LDFLAGS" \
&& pecl install imagick-3.4.3 \
&& docker-php-ext-enable imagick \
&& apk add --no-cache --virtual .imagick-runtime-deps imagemagick \
&& apk del .phpize-deps

RUN pecl install xdebug redis


RUN docker-php-ext-enable redis

# fix work iconv library with alphine


RUN apk add gnu-libiconv --update-cache --repository [Link]
[Link]/alpine/v3.12/community/ --allow-untrusted
ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php

# Datadog
RUN curl -LO
[Link]
[Link] \
&& php [Link] --php-bin=all

# Install PHP dependencies. Must copy app code before we build autoloader or run
post install scripts.
# Note: Vendor files change less frequently than our application code, so we want
to make vendor files cacheable.
RUN curl -sS [Link] | \
php -- --install-dir=/usr/local/bin/ --filename=composer

COPY ./docker/vehicle-image-processor-app/files/root/.bashrc /root/.bashrc


COPY ./[Link] /var/www/
COPY ./[Link] /var/www/
RUN composer install --no-dev --no-scripts --no-autoloader --no-ansi --no-
interaction --working-dir=/var/www/

# Copy supervisor scripts into container (only used by worker servers)


COPY
./docker/vehicle-image-processor-app/files/etc/supervisor/conf.d/[Link]
/etc/supervisor.d/[Link]

COPY ./docker/vehicle-image-processor-app/files/php/[Link]
/usr/local/etc/php/conf.d/
COPY ./docker/vehicle-image-processor-app/files/php/[Link]
/usr/local/etc/php/conf.d/

COPY ./docker/vehicle-image-processor-app/[Link] /[Link]

RUN chmod +x /[Link]

# Copy application code into container


ADD ./ /var/www

RUN chown -R www-data /var/www/bootstrap \


&& chown -R www-data:www-data /var/www \
&& sed -i "s/pm.max_children = 5/pm.max_children = 20/"
/usr/local/etc/php-fpm.d/[Link]

# Build autoloader, run composer scripts, remove composer.


RUN composer dump-autoload --optimize --no-ansi --no-interaction
--working-dir=/var/www/

RUN npm install && npm run prod

COPY ./docker/vehicle-image-processor-app/files/var/spool/cron/crontabs/root
/var/spool/cron/crontabs

VOLUME /var/www
WORKDIR /var/www

CMD /[Link]

You might also like