Skip to content

Commit

Permalink
Completely refactored PHP 8.1 image, added Blackfire support
Browse files Browse the repository at this point in the history
  • Loading branch information
markshust committed Apr 12, 2022
1 parent 019922e commit 903f986
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 76 deletions.
8 changes: 7 additions & 1 deletion compose/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ services:
- "magento.test:172.17.0.1"

phpfpm:
image: markoshust/magento-php:7.4-fpm-13
image: markoshust/magento-php:8.1-fpm-0
volumes: *appvolumes
extra_hosts: *appextrahosts
env_file: env/phpfpm.env
Expand Down Expand Up @@ -89,6 +89,12 @@ services:
- "1080:1080"
extra_hosts: *appextrahosts

blackfire:
image: blackfire/blackfire:2
ports:
- "8307"
env_file: env/blackfire.env

## Selenium support, uncomment to enable
#selenium:
# image: selenium/standalone-chrome-debug:3.8.1
Expand Down
4 changes: 4 additions & 0 deletions compose/env/blackfire.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
BLACKFIRE_DISABLE_LEGACY_PORT=true
BLACKFIRE_LOG_LEVEL=
BLACKFIRE_SERVER_ID=
BLACKFIRE_SERVER_TOKEN=
2 changes: 2 additions & 0 deletions compose/env/phpfpm.env
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
BLACKFIRE_CLIENT_ID=
BLACKFIRE_CLIENT_TOKEN=
COMPOSER_DISABLE_XDEBUG_WARN=1
151 changes: 76 additions & 75 deletions images/php/8.1/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,92 +2,93 @@ FROM php:8.1.4-fpm-buster
MAINTAINER Mark Shust <[email protected]>

ARG APP_ID=1000

RUN apt-get update && apt-get install -y \
cron \
default-mysql-client \
git \
gzip \
libbz2-dev \
libfreetype6-dev \
libicu-dev \
libwebp-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libonig-dev \
libpng-dev \
libsodium-dev \
libssh2-1-dev \
libxslt1-dev \
libzip-dev \
lsof \
procps \
vim \
zip

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

RUN docker-php-ext-install \
bcmath \
bz2 \
calendar \
exif \
gd \
gettext \
intl \
mbstring \
mysqli \
opcache \
pcntl \
pdo_mysql \
soap \
sockets \
sodium \
sysvmsg \
sysvsem \
sysvshm \
xsl \
zip

RUN pecl channel-update pecl.php.net \
&& pecl install xdebug \
&& docker-php-ext-enable xdebug

RUN pecl install ssh2-1.3.1 \
&& docker-php-ext-enable ssh2

RUN pecl install redis \
&& docker-php-ext-enable redis

RUN apt-get install -y libmagickwand-dev \
&& pecl install imagick \
&& docker-php-ext-enable imagick

RUN groupadd -g "$APP_ID" app \
&& useradd -g "$APP_ID" -u "$APP_ID" -d /var/www -s /bin/bash app

RUN apt-get install -y gnupg \
&& curl -sL https://deb.nodesource.com/setup_14.x | bash - \
&& apt-get install -y nodejs \
&& mkdir /var/www/.config /var/www/.npm \
&& chown app:app /var/www/.config /var/www/.npm \
&& npm install -g grunt-cli
RUN mkdir -p /etc/nginx/html /var/www/html /sock \
&& chown -R app:app /etc/nginx /var/www /usr/local/etc/php/conf.d /sock

RUN apt-get install -y msmtp mailutils
COPY conf/msmtprc /etc/msmtprc
RUN apt-get update && apt-get install -y \
cron \
default-mysql-client \
git \
gnupg \
gzip \
libbz2-dev \
libfreetype6-dev \
libicu-dev \
libwebp-dev \
libjpeg62-turbo-dev \
libmagickwand-dev \
libmcrypt-dev \
libonig-dev \
libpng-dev \
libsodium-dev \
libssh2-1-dev \
libxslt1-dev \
libzip-dev \
lsof \
mailutils \
msmtp \
procps \
vim \
zip \
&& rm -rf /var/lib/apt/lists/*

RUN pecl channel-update pecl.php.net && pecl install \
imagick \
redis \
ssh2-1.3.1 \
xdebug \
&& pecl clear-cache \
&& rm -rf /tmp/pear

RUN docker-php-ext-configure \
gd --with-freetype --with-jpeg --with-webp \
&& docker-php-ext-install \
bcmath \
bz2 \
calendar \
exif \
gd \
gettext \
intl \
mbstring \
mysqli \
opcache \
pcntl \
pdo_mysql \
soap \
sockets \
sodium \
sysvmsg \
sysvsem \
sysvshm \
xsl \
zip \
&& docker-php-ext-enable \
imagick \
redis \
ssh2 \
xdebug

RUN version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \
&& architecture=$(uname -m) \
&& curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/linux/$architecture/$version \
&& mkdir -p /tmp/blackfire \
&& tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp/blackfire \
&& mv /tmp/blackfire/blackfire-*.so $(php -r "echo ini_get ('extension_dir');")/blackfire.so \
&& printf "extension=blackfire.so\nblackfire.agent_socket=tcp://blackfire:8307\n" > $PHP_INI_DIR/conf.d/blackfire.ini \
&& rm -rf /tmp/blackfire /tmp/blackfire-probe.tar.gz

RUN curl -sS https://getcomposer.org/installer | \
php -- --install-dir=/usr/local/bin --filename=composer

COPY conf/www.conf /usr/local/etc/php-fpm.d/
COPY conf/msmtprc /etc/msmtprc
COPY conf/php.ini /usr/local/etc/php/
COPY conf/php-fpm.conf /usr/local/etc/

RUN mkdir -p /etc/nginx/html /var/www/html /sock \
&& chown -R app:app /etc/nginx /var/www /usr/local/etc/php/conf.d /sock
COPY conf/www.conf /usr/local/etc/php-fpm.d/

USER app:app

VOLUME /var/www

WORKDIR /var/www/html

0 comments on commit 903f986

Please sign in to comment.