Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PHP 8.4 #220

Merged
merged 1 commit into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
164 changes: 164 additions & 0 deletions php/8.4/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
FROM php:8.4.1-fpm

LABEL maintainer="Riddhesh Sanghvi <riddhesh237@gmail.com>"
LABEL org.label-schema.schema-version="1.0.0"
LABEL org.label-schema.vendor="EasyEngine"
LABEL org.label-schema.name="php"

RUN set -ex; \
apt-get update; \
apt-get install -y --no-install-recommends \
imagemagick \
less \
mariadb-client msmtp \
libc-client-dev \
libfreetype6-dev \
libjpeg-dev \
libjpeg62-turbo-dev \
libkrb5-dev \
libmagickwand-dev \
libgraphicsmagick1-dev \
libmcrypt-dev \
libicu-dev \
libmemcached-dev \
libxml2-dev \
libpng-dev \
libzip-dev \
libssl-dev \
libgmp-dev \
tmux \
unzip \
vim \
zip

# RUN curl -fsSLOJ https://pecl.php.net/get/mcrypt/stable \
# && tar -xf mcrypt-1.0.7.tgz
# RUN cd mcrypt-1.0.7 \
# && phpize \
# && ./configure \
# && make \
# && curl -fsSLOJ https://github.com/php/pecl-encryption-mcrypt/commit/5b16bf1c97c1bbab400fc877285bf0919ae73256.diff \
# && git apply 5b16bf1c97c1bbab400fc877285bf0919ae73256.diff \
# && make test \
# && cp modules/*.so $(pecl config-get ext_dir) \
# && cd .. \
# && rm -rf mcrypt-1.0.7.tgz mcrypt-1.0.7
# RUN echo extension="mcrypt.so" > /usr/local/etc/php/conf.d/php-ext-mcrypt.ini

RUN pecl install imagick; \
pecl install memcached; \
pecl install redis; \
pecl install apcu; \
# https://github.com/php/pecl-encryption-mcrypt/issues/7#issuecomment-1050994596
pecl install -n mcrypt; \
echo "yes" | pecl install imap; \
pecl install gmagick-2.0.6RC1; \
pecl install timezonedb; \
docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp; \
docker-php-ext-configure zip; \
docker-php-ext-install gd; \
docker-php-ext-install mysqli; \
docker-php-ext-install pdo_mysql; \
docker-php-ext-install opcache; \
docker-php-ext-install soap; \
docker-php-ext-install intl; \
docker-php-ext-install zip; \
docker-php-ext-install exif; \
docker-php-ext-install calendar; \
docker-php-ext-install gmp; \
docker-php-ext-install pcntl; \
docker-php-ext-install shmop; \
docker-php-ext-install sockets; \
docker-php-ext-install sysvsem; \
docker-php-ext-install sysvshm; \
docker-php-ext-install bcmath; \
docker-php-ext-enable mcrypt; \
docker-php-ext-enable redis; \
docker-php-ext-enable timezonedb; \
docker-php-ext-enable apcu; \
docker-php-ext-enable imagick; \
echo "extension=memcached.so" >> /usr/local/etc/php/conf.d/memcached.ini; \
echo "extension=gmagick.so" >> /usr/local/etc/php/conf.d/gmagick.ini; \
echo "extension=imap.so" > /usr/local/etc/php/conf.d/imap.ini; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
rm -rf /var/lib/apt/lists/*;

# Temp workaround for imagick
# RUN apt update && apt install -y git --no-install-recommends && \
# git clone https://github.com/Imagick/imagick.git --depth 1 /tmp/imagick && \
# cd /tmp/imagick && \
# git fetch origin master && \
# git switch master && \
# cd /tmp/imagick && \
# phpize && \
# ./configure && \
# make && \
# make install && \
# docker-php-ext-enable imagick && \
# apt remove -y git && \
# apt autoremove -y && \
# apt clean && \
# rm -rf /var/lib/apt/lists/* && \
# rm -rf /tmp/imagick

# set recommended PHP.ini settings
# see https://secure.php.net/manual/en/opcache.installation.php
RUN { \
echo 'opcache.memory_consumption=128'; \
echo 'opcache.interned_strings_buffer=8'; \
echo 'opcache.max_accelerated_files=4000'; \
echo 'opcache.revalidate_freq=2'; \
echo 'opcache.fast_shutdown=1'; \
echo 'opcache.enable_cli=1'; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini

# Donwload and install composer
RUN curl -sSL "https://getcomposer.org/installer" | php \
&& mv composer.phar /usr/local/bin/composer

# Install wp-cli
RUN curl -O "https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar" \
&& chmod +x wp-cli.phar \
&& mv wp-cli.phar /usr/local/bin/wp

# Setup a config file
RUN mkdir -p /etc/wp-cli
RUN { \
echo 'path: /var/www/htdocs'; \
} > /etc/wp-cli/config.yml

RUN mkdir /usr/local/etc/misc && \
touch /usr/local/etc/misc/msmtprc && \
ln -s /usr/local/etc/misc/msmtprc /etc/msmtprc && \
chown www-data:www-data /usr/local/etc/misc/msmtprc && \
chown www-data:www-data /etc/msmtprc

# RUN latest_build=$(curl -s https://download.newrelic.com/php_agent/release/ | grep 'linux.tar.gz' | sed 's/.*"\(.*\)".*/\1/') && \
# curl -L "https://download.newrelic.com$latest_build" | tar -C /tmp -zx && \
# export NR_INSTALL_USE_CP_NOT_LN=1 && \
# export NR_INSTALL_SILENT=1 && \
# /tmp/newrelic-php5-*/newrelic-install install && \
# rm -rf /tmp/newrelic-php5-* /tmp/nrinstall*

# ENV NR_PORT=/run/newrelic/newrelic.sock

# Setup logs
RUN mkdir -p /var/log/php; \
chown -R www-data: /var/log/php; \
rm /usr/local/etc/php-fpm.d/*;
COPY php.ini /usr/local/etc/php/php.ini
COPY easyengine.conf /usr/local/etc/php-fpm.d/easyengine.conf

COPY expose_off.ini /usr/local/etc/php/conf.d/expose_off.ini
COPY bashrc /root/.bashrc
COPY bashrc /var/www/.bashrc
COPY docker-entrypoint.sh /usr/local/bin/
# COPY newrelic.ini /usr/local/etc/php/conf.d/newrelic.ini
# COPY newrelic.ini /data/newrelic.ini

WORKDIR /var/www/htdocs
RUN usermod -s /bin/bash www-data
USER www-data

ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["php-fpm"]
2 changes: 2 additions & 0 deletions php/8.4/bashrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PS1="\`if [ \$? = 0 ]; then echo \[\e[37m\]^_^[\u@$VIRTUAL_HOST:\w]\\$ \[\e[0m\]; else echo \[\e[31m\]O_O[\u@$VIRTUAL_HOST:\w]\\$ \[\e[0m\]; fi\`"
export HISTTIMEFORMAT="%d/%m/%y %T "
12 changes: 12 additions & 0 deletions php/8.4/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
set -euo pipefail -o nounset

if [[ -z "${NEWRELIC_LICENSE_KEY:-}" ]] || [[ -z "${NEWRELIC_APPNAME:-}" ]]; then
:
else
sed -i -e "s/\"REPLACE_WITH_REAL_KEY\"/\"$NEWRELIC_LICENSE_KEY\"/" \
-e "s/newrelic.appname = \"PHP Application\"/newrelic.appname = \"$NEWRELIC_APPNAME\"/" \
/usr/local/etc/php/conf.d/newrelic.ini
fi

exec "$@"
20 changes: 20 additions & 0 deletions php/8.4/easyengine.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[global]
error_log = /var/log/php/error.log
daemonize = no

[www]
ping.path = /ee-admin/ping
pm.status_path = /ee-admin/status
request_terminate_timeout = 300
user = www-data
group = www-data
pm = ondemand
pm.max_children = 20
listen = 9000
; if we send this to /proc/self/fd/1, it never appears
access.log = /var/log/php/access.log

clear_env = no

; Ensure worker stdout and stderr are sent to the main error log.
catch_workers_output = yes
1 change: 1 addition & 0 deletions php/8.4/expose_off.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
expose_php = Off
18 changes: 18 additions & 0 deletions php/8.4/newrelic.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
; This file contains the various settings for the New Relic PHP agent. There
; are many options, all of which are described in detail at the following URL:
; https://docs.newrelic.com/docs/agents/php-agent/configuration/php-agent-configuration
;

extension = "newrelic.so"

[newrelic]
newrelic.license = "REPLACE_WITH_REAL_KEY"
newrelic.appname = "PHP Application"
newrelic.logfile = "/var/log/newrelic/php_agent.log"
newrelic.daemon.logfile = "/var/log/newrelic/newrelic-daemon.log"
newrelic.daemon.port = "/run/newrelic/newrelic.sock"
newrelic.transaction_tracer.record_sql = "raw"
newrelic.transaction_tracer.threshold = "1s"
newrelic.browser_monitoring.auto_instrument = 0
newrelic.application_logging.forwarding.log_level = error
newrelic.daemon.dont_launch = 3
Loading