Skip to content

Commit

Permalink
feat: Add PHP 8.3 & 8.4 and Node 22
Browse files Browse the repository at this point in the history
  • Loading branch information
khalwat committed Jan 9, 2025
1 parent 8f085ac commit 4fcb036
Show file tree
Hide file tree
Showing 19 changed files with 409 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-and-push-docker-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: ["14", "16", "18", "20"]
node: ["14", "16", "18", "20", "22"]
name: node-dev-base ${{ matrix.node }} images
steps:
- name: Check out the repository
Expand Down Expand Up @@ -40,7 +40,7 @@ jobs:
strategy:
fail-fast: true
matrix:
php: ["7.4", "8.0", "8.1", "8.2"]
php: ["7.4", "8.0", "8.1", "8.2", "8.3", "8.4"]
name: php-dev-base ${{ matrix.php }} images
steps:
- name: Check out the repository
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-docker-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
fail-fast: true
matrix:
node: ["14", "16", "18", "20"]
node: ["14", "16", "18", "20", "22"]
name: node-dev-base ${{ matrix.node }} images
steps:
- name: Check out the repository
Expand Down Expand Up @@ -41,7 +41,7 @@ jobs:
strategy:
fail-fast: true
matrix:
php: ["7.4", "8.0", "8.1", "8.2"]
php: ["7.4", "8.0", "8.1", "8.2", "8.3", "8.4"]
name: php-dev-base ${{ matrix.php }} images
steps:
- name: Check out the repository
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ PHP_PROD_NAMESPACE?=php-prod-base
PHP_DEV_NAMESPACE?=php-dev-base
NODE_NAMESPACE?=node-dev-base

PHP_VERSIONS?=php-7.4-alpine php-8.0-alpine php-8.1-alpine php-8.2-alpine
NODE_VERSIONS?=node-14-alpine node-16-alpine node-18-alpine node-20-alpine
PHP_VERSIONS?=php-7.4-alpine php-8.0-alpine php-8.1-alpine php-8.2-alpine php-8.3-alpine php-8.4-alpine
NODE_VERSIONS?=node-14-alpine node-16-alpine node-18-alpine node-20-alpine node-22-alpine

.PHONY: all create-builder php $(PHP_VERSIONS) node $(NODE_VERSIONS)

Expand Down
52 changes: 52 additions & 0 deletions node-dev-base/node-22-alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
FROM node:22-alpine

# Install packages for headless chrome
RUN apk update \
&& \
apk add --no-cache nmap \
&& \
echo @edge http://nl.alpinelinux.org/alpine/edge/community >> /etc/apk/repositories \
&& \
echo @edge http://nl.alpinelinux.org/alpine/edge/main >> /etc/apk/repositories \
&& \
apk update \
&& \
apk add --no-cache \
# Packages needed for npm install of mozjpeg & cwebp, can't --virtual and apk del later
# Pre-builts do not work on alpine for either:
# ref: https://github.com/imagemin/imagemin/issues/168
# ref: https://github.com/imagemin/cwebp-bin/issues/27
autoconf \
automake \
build-base \
g++ \
gcc \
glu \
libc6-compat \
libtool \
libpng-dev \
libxxf86vm \
make \
nasm \
# Misc packages
nano \
# Image optimization packages
gifsicle \
jpegoptim \
libpng-dev \
libwebp-tools \
libjpeg-turbo-dev \
libjpeg-turbo-utils \
optipng \
pngquant \
# Headless Chrome packages
chromium \
harfbuzz \
"freetype>2.8" \
ttf-freefont \
nss

ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
ENV CHROME_BIN /usr/bin/chromium-browser
ENV LIGHTHOUSE_CHROMIUM_PATH /usr/bin/chromium-browser
46 changes: 46 additions & 0 deletions php-dev-base/php-8.3-alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
FROM nystudio107/php-prod-base:8.3-alpine

# Install packages
RUN set -eux; \
# Packages needed only for build
apk add --no-cache --virtual .build-deps \
# Dependencies required for running "phpize"; the $PHPIZE_DEPS env var is inherited from the parent image
# These get automatically installed and removed by "docker-php-ext-*" (unless they're already installed)
$PHPIZE_DEPS \
# Build deps
autoconf \
dpkg-dev \
dpkg \
file \
g++ \
gcc \
libc-dev \
make \
pkgconf \
re2c \
libtool \
linux-headers \
wget \
&& \
# pecl PHP extensions
pecl install \
xdebug \
&& \
# Enable PHP extensions
docker-php-ext-enable \
xdebug \
&& \
# Remove the build deps
apk del .build-deps \
&& \
# Clean out directories that don't need to be part of the image
rm -rf /tmp/* /var/tmp/*

# Copy the `xdebug.ini` file into place for xdebug
COPY ./xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini

# Copy the `zzz-docker-php.ini` file into place for php
COPY zzz-docker-php.ini /usr/local/etc/php/conf.d/

# Copy the `zzz-docker-php-fpm.conf` file into place for php-fpm
COPY zzz-docker-php-fpm.conf /usr/local/etc/php-fpm.d/
4 changes: 4 additions & 0 deletions php-dev-base/php-8.3-alpine/xdebug.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
xdebug.mode=develop,debug,profile,coverage
xdebug.start_with_request=trigger
xdebug.client_host=host.docker.internal
xdebug.output_dir = "/var/www/project/cms/storage/logs"
4 changes: 4 additions & 0 deletions php-dev-base/php-8.3-alpine/zzz-docker-php-fpm.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[www]
pm.max_children = 5
pm.process_idle_timeout = 30s
pm.max_requests = 1000
9 changes: 9 additions & 0 deletions php-dev-base/php-8.3-alpine/zzz-docker-php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[php]
memory_limit=256M
max_execution_time=300
max_input_time=300
max_input_vars=5000
upload_max_filesize=100M
post_max_size=100M
[opcache]
opcache.enable=0
46 changes: 46 additions & 0 deletions php-dev-base/php-8.4-alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
FROM nystudio107/php-prod-base:8.4-alpine

# Install packages
RUN set -eux; \
# Packages needed only for build
apk add --no-cache --virtual .build-deps \
# Dependencies required for running "phpize"; the $PHPIZE_DEPS env var is inherited from the parent image
# These get automatically installed and removed by "docker-php-ext-*" (unless they're already installed)
$PHPIZE_DEPS \
# Build deps
autoconf \
dpkg-dev \
dpkg \
file \
g++ \
gcc \
libc-dev \
make \
pkgconf \
re2c \
libtool \
linux-headers \
wget \
&& \
# pecl PHP extensions
pecl install \
xdebug \
&& \
# Enable PHP extensions
docker-php-ext-enable \
xdebug \
&& \
# Remove the build deps
apk del .build-deps \
&& \
# Clean out directories that don't need to be part of the image
rm -rf /tmp/* /var/tmp/*

# Copy the `xdebug.ini` file into place for xdebug
COPY ./xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini

# Copy the `zzz-docker-php.ini` file into place for php
COPY zzz-docker-php.ini /usr/local/etc/php/conf.d/

# Copy the `zzz-docker-php-fpm.conf` file into place for php-fpm
COPY zzz-docker-php-fpm.conf /usr/local/etc/php-fpm.d/
4 changes: 4 additions & 0 deletions php-dev-base/php-8.4-alpine/xdebug.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
xdebug.mode=develop,debug,profile,coverage
xdebug.start_with_request=trigger
xdebug.client_host=host.docker.internal
xdebug.output_dir = "/var/www/project/cms/storage/logs"
4 changes: 4 additions & 0 deletions php-dev-base/php-8.4-alpine/zzz-docker-php-fpm.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[www]
pm.max_children = 5
pm.process_idle_timeout = 30s
pm.max_requests = 1000
9 changes: 9 additions & 0 deletions php-dev-base/php-8.4-alpine/zzz-docker-php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[php]
memory_limit=256M
max_execution_time=300
max_input_time=300
max_input_vars=5000
upload_max_filesize=100M
post_max_size=100M
[opcache]
opcache.enable=0
2 changes: 1 addition & 1 deletion php-prod-base/php-8.2-alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:8.2-fpm-alpine3.18
FROM php:8.2-fpm-alpine

# Install packages
RUN set -eux; \
Expand Down
95 changes: 95 additions & 0 deletions php-prod-base/php-8.3-alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
FROM php:8.3-fpm-alpine

ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/

# Install packages
RUN set -eux; \
# Packages needed only for build
apk add --no-cache --virtual .build-deps \
# Dependencies required for running "phpize"; the $PHPIZE_DEPS env var is inherited from the parent image
# These get automatically installed and removed by "docker-php-ext-*" (unless they're already installed)
$PHPIZE_DEPS \
# Build deps
autoconf \
dpkg-dev \
dpkg \
file \
g++ \
gcc \
libc-dev \
make \
pkgconf \
re2c \
libtool \
linux-headers \
wget \
&& \
# Packages to install
apk add --no-cache \
bzip2-dev \
ca-certificates \
curl \
fcgi \
freetype-dev \
gettext-dev \
icu-dev \
icu-data-full \
imagemagick-dev \
jpeg-dev \
libpng-dev \
libwebp-dev \
libzip-dev \
libtool \
libxml2-dev \
libzip-dev \
oniguruma-dev \
openssl-dev \
unzip \
&& \
# pecl PHP extensions
pecl install \
redis \
&& \
# Configure PHP extensions
docker-php-ext-configure \
# ref: https://github.com/docker-library/php/issues/920#issuecomment-562864296
gd --enable-gd --with-freetype --with-jpeg --with-webp \
&& \
install-php-extensions \
gmagick \
&& \
# Install PHP extensions
docker-php-ext-install -j$(nproc) \
bcmath \
bz2 \
exif \
ftp \
gettext \
gd \
intl \
mbstring \
opcache \
pdo \
shmop \
sockets \
sysvmsg \
sysvsem \
sysvshm \
zip \
&& \
# Enable PHP extensions
docker-php-ext-enable \
gmagick \
redis \
&& \
# Remove the build deps
apk del .build-deps \
&& \
# Clean out directories that don't need to be part of the image
rm -rf /tmp/* /var/tmp/*

# Copy the `zzz-docker-php.ini` file into place for php
COPY zzz-docker-php.ini /usr/local/etc/php/conf.d/

# Copy the `zzz-docker-php-fpm.conf` file into place for php-fpm
COPY zzz-docker-php-fpm.conf /usr/local/etc/php-fpm.d/
4 changes: 4 additions & 0 deletions php-prod-base/php-8.3-alpine/zzz-docker-php-fpm.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[www]
pm.max_children = 10
pm.process_idle_timeout = 30s
pm.max_requests = 1000
13 changes: 13 additions & 0 deletions php-prod-base/php-8.3-alpine/zzz-docker-php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[php]
memory_limit=256M
max_execution_time=300
max_input_time=300
max_input_vars=5000
upload_max_filesize=100M
post_max_size=100M
[opcache]
opcache.enable=1
opcache.revalidate_freq=0
opcache.validate_timestamps=1
opcache.jit_buffer_size=100M
opcache.jit=tracing
Loading

0 comments on commit 4fcb036

Please sign in to comment.