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

WIP: Adding PHP 8.4 images #308

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
strategy:
fail-fast: false
matrix:
version: [73, 74, 80, 81, 82, 83]
version: [73, 74, 80, 81, 82, 83, 84]
with:
version: ${{ matrix.version }}
secrets: inherit
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Although this project started as a development environment for Totara Learn it c
### What You Get
* [NGINX](https://nginx.org/) as a webserver
* [Apache](https://httpd.apache.org/) as a webserver
* [PHP](http://php.net/) 5.3, 5.4, 5.5, 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3 to test for different versions
* [PHP](http://php.net/) 5.3, 5.4, 5.5, 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3, 8.4 to test for different versions
* [PostgreSQL](https://www.postgresql.org/) (9.3, 9.6, 10, 11, 12, 13, 14, 15, 16),
* [MariaDB](https://mariadb.org/) (10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.11, 11.4),
* [MySQL](https://www.mysql.com/) (5.7, 8.0, 8.4),
Expand Down
12 changes: 12 additions & 0 deletions compose/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,15 @@ services:
php-8.3-debug:
build: ./php/php83-debug

php-8.4:
build:
context: ./php/php84
args:
TIME_ZONE: ${TIME_ZONE}

php-8.4-cron:
build: ./php/php84-cron

php-8.4-debug:
build: ./php/php84-debug

51 changes: 51 additions & 0 deletions compose/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,57 @@ services:
networks:
- totara


php-8.4:
image: totara/docker-dev-php84
container_name: totara_php83
working_dir: ${REMOTE_SRC}
environment:
CONTAINERNAME: php-8.4
HIST_FILE: /root/.bash_history
DISABLE_AUTO_UPDATE: "true" # disables oh-my-zsh update message
volumes:
- ${LOCAL_SRC}:${REMOTE_SRC}
- totara-data:${REMOTE_DATA}
- bash-history:/root/.bash_history
- zsh-history:/root/.zsh_history
- ./shell:/root/custom_shell
depends_on:
- php-8.4-debug
networks:
- totara

php-8.4-cron:
image: totara/docker-dev-php84-cron
container_name: totara_php84_cron
volumes:
- ${LOCAL_SRC}:${REMOTE_SRC}
- totara-data:${REMOTE_DATA}
- ./cron.d:/etc/cron.d
networks:
- totara

php-8.4-debug:
image: totara/docker-dev-php84-debug
container_name: totara_php84_debug
working_dir: ${REMOTE_SRC}
environment:
CONTAINERNAME: php-8.4-debug
TZ: ${TIME_ZONE}
XDEBUG_CONFIG: client_host=${HOST_IP}
XDEBUG_SESSION: totara84
PHP_IDE_CONFIG: serverName=totara84
HIST_FILE: /root/.bash_history
DISABLE_AUTO_UPDATE: "true" # disables oh-my-zsh update message
volumes:
- ${LOCAL_SRC}:${REMOTE_SRC}
- totara-data:${REMOTE_DATA}
- bash-history:/root/.bash_history
- zsh-history:/root/.zsh_history
- ./shell:/root/custom_shell
networks:
- totara

volumes:
totara-data:
bash-history:
Expand Down
9 changes: 9 additions & 0 deletions php/php84-cron/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM totara/docker-dev-php84:latest

RUN apt-get update && apt-get install -y cron

COPY entrypoint.sh /entrypoint.sh

RUN chmod +x /entrypoint.sh

CMD ["/entrypoint.sh"]
11 changes: 11 additions & 0 deletions php/php84-cron/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

if [ -e /etc/cron.d/*.cron ]
then
# Install new crontab using all .cron files
cat /etc/cron.d/*.cron | crontab - \
&& crontab -l \
&& cron -f
else
echo "No .cron files found in cron.d folder"
fi
16 changes: 16 additions & 0 deletions php/php84-debug/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM totara/docker-dev-php84:latest

RUN pecl channel-update pecl.php.net && \
pecl install -f xdebug-3.4.0 && docker-php-ext-enable xdebug.so && \
pecl install -f pcov && docker-php-ext-enable pcov.so

RUN echo "xdebug.mode=debug" >> /usr/local/etc/php/conf.d/xdebug.ini \
&& echo "xdebug.start_with_request=trigger" >> /usr/local/etc/php/conf.d/xdebug.ini

# Set some sensible defaults
RUN echo "pcov.enabled=1" >> /usr/local/etc/php/conf.d/docker-php-ext-pcov.ini \
&& echo "pcov.exclude='~(vendor|tests|node_modules|.git|client|.scannerwork)~'" >> /usr/local/etc/php/conf.d/docker-php-ext-pcov.ini \
# The next line can be enabled (and applied with tbuild and tup of this container) to optimise memory usage \
# Note that PHP's memory limit needs to be high enough.
#&& echo "pcov.initial.memory=1073741824" >> /usr/local/etc/php/conf.d/docker-php-ext-pcov.ini \
&& echo "pcov.initial.files=30000" >> /usr/local/etc/php/conf.d/docker-php-ext-pcov.ini
133 changes: 133 additions & 0 deletions php/php84/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
FROM php:8.4-fpm-bullseye

ARG TIME_ZONE=Pacific/Auckland

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
apt-transport-https \
libfreetype6-dev \
libjpeg62-turbo-dev \
libwebp-dev \
libmcrypt-dev \
libpng-dev \
libxml2-dev \
libicu-dev \
libpq-dev \
gnupg2 \
nano \
vim \
wget \
openssl \
locales \
tzdata \
git \
libzip-dev \
libmemcached-dev \
zip \
netcat \
bc \
ghostscript \
graphviz \
aspell \
libldap2-dev \
libltdl-dev \
libc-client-dev \
libkrb5-dev \
libssl-dev \
&& docker-php-ext-install -j$(nproc) \
zip \
intl \
soap \
opcache \
pdo_pgsql \
pdo_mysql \
pgsql \
mysqli \
exif \
ldap \
&& docker-php-ext-configure gd \
--with-freetype \
--with-jpeg \
--with-webp \
&& docker-php-ext-install -j$(nproc) gd

RUN git clone https://github.com/longxinH/xhprof.git ./xhprof \
&& cd xhprof \
&& git checkout v2.3.10 \
&& cd extension/ \
&& phpize \
&& ./configure \
&& make && make install

RUN echo "extension=xhprof.so" >> /usr/local/etc/php/conf.d/xhprof.ini \
&& echo "xhprof.output_dir = /tmp/xhprof" >> /usr/local/etc/php/conf.d/xhprof.ini

RUN pecl channel-update pecl.php.net && \
pecl install -o -f redis \
&& rm -rf /tmp/pear \
&& docker-php-ext-enable redis

RUN pecl channel-update pecl.php.net && \
pecl install -o -f igbinary \
&& rm -rf /tmp/pear \
&& docker-php-ext-enable igbinary

RUN pecl channel-update pecl.php.net && \
pecl install -o -f memcached \
&& rm -rf /tmp/pear \
&& docker-php-ext-enable memcached

RUN pecl channel-update pecl.php.net && \
pecl install -o -f imap \
&& rm -rf /tmp/pear \
&& docker-php-ext-enable imap

# we need en_US locales for MSSQL connection to work
# we need en_AU locales for behat to work
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
sed -i -e 's/# en_AU.UTF-8 UTF-8/en_AU.UTF-8 UTF-8/' /etc/locale.gen && \
dpkg-reconfigure --frontend=noninteractive locales && \
update-locale LANG=en_US.UTF-8

ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US.UTF-8
ENV LC_ALL=en_US.UTF-8

# install mssql extension
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list \
&& apt-get update && ACCEPT_EULA=Y apt-get install -y \
msodbcsql18 \
mssql-tools18 \
unixodbc-dev

RUN echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile \
&& echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc

# Workaround applied: https://github.com/microsoft/msphpsql/issues/1438#issuecomment-1444773949
RUN pear config-set php_ini `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"` system \
&& pecl install sqlsrv-5.12.0 pdo_sqlsrv-5.12.0 || \
apt-get install -y --allow-downgrades odbcinst=2.3.7 odbcinst1debian2=2.3.7 unixodbc=2.3.7 unixodbc-dev=2.3.7 && \
pecl install sqlsrv-5.12.0 pdo_sqlsrv-5.12.0

RUN docker-php-ext-enable sqlsrv.so && docker-php-ext-enable pdo_sqlsrv.so

RUN ln -fs /usr/share/zoneinfo/${TIME_ZONE} /etc/localtime \
&& dpkg-reconfigure --frontend noninteractive tzdata

COPY config/php.ini /usr/local/etc/php/
COPY config/fpm.conf /usr/local/etc/php-fpm.d/zz-totara.conf

# Source each .sh file found in the /shell/ folder, always source the default_aliases.sh file first
RUN echo 'if [[ -e "/root/custom_shell/default-aliases.sh" ]]; then source "/root/custom_shell/default-aliases.sh"; fi' >> ~/.bashrc && \
echo 'for f in /root/custom_shell/*.sh; do [[ "$f" != "/root/custom_shell/default-aliases.sh" && -e "$f" ]] && source "$f"; done;' >> ~/.bashrc

# Have the option of using the oh my zsh shell.
RUN apt-get update && apt-get install -y zsh
RUN sh -c "$(curl https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" --unattended
RUN git clone https://github.com/romkatv/powerlevel10k ~/.oh-my-zsh/custom/themes/powerlevel10k
RUN git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
RUN git clone https://github.com/zsh-users/zsh-completions ~/.oh-my-zsh/custom/plugins/zsh-completions
RUN git clone https://github.com/zsh-users/zsh-syntax-highlighting ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
RUN echo 'setopt +o nomatch' > ~/.zshrc
RUN echo 'source ~/custom_shell/.zshrc' >> ~/.zshrc
RUN cat ~/.bashrc >> ~/.zshrc
2 changes: 2 additions & 0 deletions php/php84/config/fpm.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[www]
pm.max_children = 50
10 changes: 10 additions & 0 deletions php/php84/config/php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
log_errors = On
error_log = /dev/stderr
error_reporting = E_ALL & ~E_DEPRECATED
max_input_vars=5000
date.timezone = Pacific/Auckland
memory_limit=256M
; necessary as Xdebug impacts performance that hard
max_execution_time=120
post_max_size = 64M
upload_max_filesize = 64M