From 7f1b169b3ae248842216bd8b4c5f53fadb5fca2a Mon Sep 17 00:00:00 2001 From: Alex Bouma Date: Mon, 18 Dec 2023 13:47:48 +0100 Subject: [PATCH] Add PHP 8.3 image --- .github/workflows/build.yml | 2 +- 8.3.Dockerfile | 167 ++++++++++++++++++++++++++++++++++++ README.md | 11 +-- 3 files changed, 174 insertions(+), 6 deletions(-) create mode 100644 8.3.Dockerfile diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 92cf5c3..30c165c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,7 +19,7 @@ jobs: strategy: matrix: - version: [ "8.0", "8.1", "8.2" ] + version: [ "8.0", "8.1", "8.2", "8.3" ] fail-fast: false name: docker build ${{ matrix.version }} diff --git a/8.3.Dockerfile b/8.3.Dockerfile new file mode 100644 index 0000000..27a2ae9 --- /dev/null +++ b/8.3.Dockerfile @@ -0,0 +1,167 @@ +FROM php:8.3 + +ENV XDEBUG_VERSION 3.3.1 + +# https://getcomposer.org/doc/03-cli.md#composer-allow-superuser +ENV COMPOSER_ALLOW_SUPERUSER=1 +# https://getcomposer.org/doc/03-cli.md#composer-no-interaction +ENV COMPOSER_NO_INTERACTION=1 + +RUN additionalPackages=" \ + apt-transport-https \ + git \ + wget \ + gnupg \ + msmtp-mta \ + subversion \ + mariadb-client \ + openssh-client \ + rsync \ + unzip \ + locales \ + " \ + buildDeps=" \ + freetds-dev \ + libbz2-dev \ + libc-client-dev \ + libffi-dev \ + libfreetype6-dev \ + libgmp3-dev \ + libicu-dev \ + libjpeg62-turbo-dev \ + libmagickwand-dev \ + libkrb5-dev \ + libldap2-dev \ + libmcrypt-dev \ + libpng-dev \ + libpq-dev \ + libpspell-dev \ + libonig-dev \ + librabbitmq-dev \ + libsasl2-dev \ + libsnmp-dev \ + libssl-dev \ + libtidy-dev \ + libxml2-dev \ + libxpm-dev \ + libxslt1-dev \ + zlib1g-dev \ + libzip-dev \ + " \ + && runDeps=" \ + imagemagick \ + libc-client2007e \ + libfreetype6 \ + libicu-dev \ + libjpeg62-turbo \ + libpq5 \ + libsybdb5 \ + libtidy-dev \ + libx11-dev \ + libxpm4 \ + libxslt1.1 \ + libzip4 \ + snmp \ + " \ + && phpModules=" \ + bcmath \ + bz2 \ + calendar \ + dba \ + exif \ + ffi \ + ftp \ + gd \ + gettext \ + gmp \ + imap \ + intl \ + ldap \ + mysqli \ + opcache \ + pcntl \ + pdo \ + pdo_dblib \ + pdo_mysql \ + pdo_pgsql \ + pgsql \ + pspell \ + shmop \ + snmp \ + soap \ + sockets \ + sysvmsg \ + sysvsem \ + sysvshm \ + tidy \ + xsl \ + zip \ + xdebug \ + " \ + && peclModules=" \ + amqp \ + igbinary \ + imagick \ + mongodb \ + redis \ + " \ + && echo "force-unsafe-io" > /etc/dpkg/dpkg.cfg.d/02apt-speedup \ + && echo "Acquire::http {No-Cache=True;};" > /etc/apt/apt.conf.d/no-cache \ + && apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends $additionalPackages $buildDeps $runDeps \ + && docker-php-source extract \ + && cd /usr/src/php/ext/ \ + && curl -L https://xdebug.org/files/xdebug-$XDEBUG_VERSION.tgz | tar -zxf - \ + && mv xdebug-$XDEBUG_VERSION xdebug \ + && ln -s /usr/include/*-linux-gnu/gmp.h /usr/include/gmp.h \ + && ln -s /usr/lib/*-linux-gnu/libldap_r.so /usr/lib/libldap.so \ + && ln -s /usr/lib/*-linux-gnu/libldap_r.a /usr/lib/libldap_r.a \ + && ln -s /usr/lib/*-linux-gnu/libsybdb.a /usr/lib/libsybdb.a \ + && ln -s /usr/lib/*-linux-gnu/libsybdb.so /usr/lib/libsybdb.so \ + && docker-php-ext-configure gd --with-freetype --with-jpeg \ + && docker-php-ext-configure imap --with-imap --with-kerberos --with-imap-ssl \ + && docker-php-ext-configure ldap --with-ldap-sasl \ + && docker-php-ext-install $phpModules \ + && for ext in $phpModules; do \ + rm -f /usr/local/etc/php/conf.d/docker-php-ext-$ext.ini; \ + done \ + && pecl install $peclModules \ + && docker-php-source delete \ + && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false $buildDeps \ + && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +# Configure locales (make en_US and nl_NL available) +RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ + sed -i -e 's/# nl_NL.UTF-8 UTF-8/nl_NL.UTF-8 UTF-8/' /etc/locale.gen && \ + dpkg-reconfigure --frontend=noninteractive locales + +# Install composer and put binary into $PATH +RUN curl -sS https://getcomposer.org/installer | php \ + && mv composer.phar /usr/local/bin/ \ + && ln -s /usr/local/bin/composer.phar /usr/local/bin/composer + +# Install phpunit and put binary into $PATH +RUN curl -sSLo phpunit.phar https://phar.phpunit.de/phpunit.phar \ + && chmod 755 phpunit.phar \ + && mv phpunit.phar /usr/local/bin/ \ + && ln -s /usr/local/bin/phpunit.phar /usr/local/bin/phpunit + +# Install PHP Code sniffer +RUN curl -OL https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar \ + && chmod 755 phpcs.phar \ + && mv phpcs.phar /usr/local/bin/ \ + && ln -s /usr/local/bin/phpcs.phar /usr/local/bin/phpcs \ + && curl -OL https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar \ + && chmod 755 phpcbf.phar \ + && mv phpcbf.phar /usr/local/bin/ \ + && ln -s /usr/local/bin/phpcbf.phar /usr/local/bin/phpcbf + +# Install Node.js & Yarn +RUN curl -fsSL https://raw.githubusercontent.com/tj/n/master/bin/n | bash -s lts \ + && npm install -g n && n 20 \ + && npm install -g yarn + +COPY msmtprc /etc/ +COPY entrypoint.sh /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] +CMD ["php", "-a"] diff --git a/README.md b/README.md index 5a02d32..e7961d7 100644 --- a/README.md +++ b/README.md @@ -11,16 +11,16 @@ _This repository started as a fork of [TetraWeb/docker](https://github.com/Tetra - [Most extensions](#available-extensions) are compiled and ready for loading with `docker-php-ext-enable` - Git client from official debian repo - Latest binaries of Composer, PHPUnit and PHP Code Sniffer (`phpcs` and `phpcbf`) -- Node.js v12 or v14 using the [`n`](https://github.com/tj/n) Node version manager, with `npm`, `yarn` and `n` pre-installed +- Node.js v12, v14 or v20 by default using the [`n`](https://github.com/tj/n) Node version manager, with `npm`, `yarn` and `n` pre-installed - sendmail command via msmtp, configured as relay to localhost. Check `/etc/msmtprc` to setup relay server ## Image Registries Images are available on the following registries: -- [GitHub Container Registry](https://github.com/stayallive/php/pkgs/container/php) (pull using `ghcr.io/stayallive/php:8.2`) -- [GitLab Container Registry](https://gitlab.com/stayallive/php/container_registry/3036570) (pull using `registry.gitlab.com/stayallive/php:8.2`) -- [Docker Hub](https://hub.docker.com/r/stayallive/php) (pull using `stayallive/php:8.2`) +- [GitHub Container Registry](https://github.com/stayallive/php/pkgs/container/php) (pull using `ghcr.io/stayallive/php:8.3`) +- [GitLab Container Registry](https://gitlab.com/stayallive/php/container_registry/3036570) (pull using `registry.gitlab.com/stayallive/php:8.3`) +- [Docker Hub](https://hub.docker.com/r/stayallive/php) (pull using `stayallive/php:8.3`) They are listed as `stayallive/php` and tagged by PHP version for both `linux/amd64` & `linux/arm64`. @@ -28,6 +28,7 @@ They are listed as `stayallive/php` and tagged by PHP version for both `linux/am ## PHP versions +- [`stayallive/php:8.3` (*8.3.Dockerfile*)](https://github.com/stayallive/php-docker/blob/master/8.3.Dockerfile) (Node 20 & LTS) - [`stayallive/php:8.2` (*8.2.Dockerfile*)](https://github.com/stayallive/php-docker/blob/master/8.2.Dockerfile) (Node 14 & LTS) - [`stayallive/php:8.1` (*8.1.Dockerfile*)](https://github.com/stayallive/php-docker/blob/master/8.1.Dockerfile) (Node 14 & LTS) - [`stayallive/php:8.0` (*8.0.Dockerfile*)](https://github.com/stayallive/php-docker/blob/master/8.0.Dockerfile) (Node 14 & LTS) @@ -43,7 +44,7 @@ _Keep in mind that although there might be a tag available it doesn't mean the P Starting with the PHP 8 images the [`n`](https://github.com/tj/n) Node version manager is installed. -Pre-cached is Node `14` and `LTS` with `14` set as the default. To use the `LTS` version run `n lts` in for example your `.gitlab-ci.yml` `before_script` section: +Pre-cached is Node `14`/`20` and `LTS` with `14`/`20` set as the default (see PHP versions list which Node version is the default). To use the `LTS` version run `n lts` in for example your `.gitlab-ci.yml` `before_script` section: ```yaml before_script: