Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['8.0', '8.1', '8.2', '8.3'] # add PHP versions as required
php-versions: ['8.0', '8.1', '8.2', '8.3', '8.4'] # add PHP versions as required
steps:
- name: Checkout the repo
uses: actions/checkout@v3
Expand Down
197 changes: 197 additions & 0 deletions php-8.4/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
FROM php:8.4-cli-alpine AS compile

ENV PHP_REDIS_VERSION="6.1.0" \
PHP_SWOOLE_VERSION="v5.1.7" \
PHP_IMAGICK_VERSION="3.7.0" \
PHP_YAML_VERSION="2.2.4" \
PHP_MAXMINDDB_VERSION="v1.12.0" \
PHP_SCRYPT_VERSION="2.0.1" \
PHP_ZSTD_VERSION="0.14.0" \
PHP_BROTLI_VERSION="0.15.0" \
PHP_SNAPPY_VERSION="0.2.2" \
PHP_LZ4_VERSION="0.4.4" \
PHP_XDEBUG_VERSION="3.4.1"

RUN \
apk add --no-cache --virtual .deps \
linux-headers \
icu-dev \
make \
automake \
autoconf \
gcc \
g++ \
git \
zlib-dev \
openssl-dev \
yaml-dev \
imagemagick \
imagemagick-dev \
libjpeg-turbo-dev \
jpeg-dev \
libjxl-dev \
libmaxminddb-dev \
zstd-dev \
brotli-dev \
lz4-dev \
curl-dev

RUN docker-php-ext-install sockets

FROM compile AS redis
RUN \
# Redis Extension
git clone --depth 1 --branch $PHP_REDIS_VERSION https://github.com/phpredis/phpredis.git && \
cd phpredis && \
phpize && \
./configure && \
make && make install

## Swoole Extension
FROM compile AS swoole
RUN \
git clone --depth 1 --branch $PHP_SWOOLE_VERSION https://github.com/swoole/swoole-src.git && \
cd swoole-src && \
phpize && \
./configure --enable-sockets --enable-http2 --enable-openssl --enable-swoole-curl && \
make && make install && \
cd ..

## Imagick Extension
FROM compile AS imagick
RUN \
git clone --depth 1 --branch $PHP_IMAGICK_VERSION https://github.com/imagick/imagick && \
cd imagick && \
phpize && \
./configure && \
make && make install

## YAML Extension
FROM compile AS yaml
RUN \
git clone --depth 1 --branch $PHP_YAML_VERSION https://github.com/php/pecl-file_formats-yaml && \
cd pecl-file_formats-yaml && \
phpize && \
./configure && \
make && make install

## Maxminddb extension
FROM compile AS maxmind
RUN \
git clone --depth 1 --branch $PHP_MAXMINDDB_VERSION https://github.com/maxmind/MaxMind-DB-Reader-php.git && \
cd MaxMind-DB-Reader-php && \
cd ext && \
phpize && \
./configure && \
make && make install

# Zstd Compression
FROM compile AS zstd
RUN git clone --recursive -n https://github.com/kjdev/php-ext-zstd.git \
&& cd php-ext-zstd \
&& git checkout $PHP_ZSTD_VERSION \
&& phpize \
&& ./configure --with-libzstd \
&& make && make install

## Brotli Extension
FROM compile AS brotli
RUN git clone https://github.com/kjdev/php-ext-brotli.git \
&& cd php-ext-brotli \
&& git reset --hard $PHP_BROTLI_VERSION \
&& phpize \
&& ./configure --with-libbrotli \
&& make && make install

## LZ4 Extension
FROM compile AS lz4
RUN git clone --recursive https://github.com/kjdev/php-ext-lz4.git \
&& cd php-ext-lz4 \
&& git reset --hard $PHP_LZ4_VERSION \
&& phpize \
&& ./configure --with-lz4-includedir=/usr \
&& make && make install

## Snappy Extension
FROM compile AS snappy
RUN git clone --recursive https://github.com/kjdev/php-ext-snappy.git \
&& cd php-ext-snappy \
&& git reset --hard $PHP_SNAPPY_VERSION \
&& phpize \
&& ./configure \
&& make && make install

## Scrypt Extension
FROM compile AS scrypt
RUN git clone --depth 1 https://github.com/DomBlack/php-scrypt.git \
&& cd php-scrypt \
&& git reset --hard $PHP_SCRYPT_VERSION \
&& phpize \
&& ./configure --enable-scrypt \
&& make && make install

## XDebug Extension
FROM compile AS xdebug
RUN \
git clone --depth 1 --branch $PHP_XDEBUG_VERSION https://github.com/xdebug/xdebug && \
cd xdebug && \
phpize && \
./configure && \
make && make install

FROM php:8.4-cli-alpine AS final

LABEL maintainer="[email protected]"

RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

RUN \
apk update \
&& apk add --no-cache \
linux-headers \
rsync \
brotli-dev \
lz4-dev \
zstd-dev \
yaml-dev \
imagemagick \
libjpeg-turbo \
libjxl \
libavif \
libheif \
imagemagick-heic \
libgomp \
libwebp \
git \
&& rm -rf /var/cache/apk/*

RUN docker-php-ext-install sockets

WORKDIR /usr/src/code

COPY --from=swoole /usr/local/lib/php/extensions/no-debug-non-zts-20240924/swoole.so /usr/local/lib/php/extensions/no-debug-non-zts-20240924/
COPY --from=redis /usr/local/lib/php/extensions/no-debug-non-zts-20240924/redis.so /usr/local/lib/php/extensions/no-debug-non-zts-20240924/
COPY --from=imagick /usr/local/lib/php/extensions/no-debug-non-zts-20240924/imagick.so /usr/local/lib/php/extensions/no-debug-non-zts-20240924/
COPY --from=yaml /usr/local/lib/php/extensions/no-debug-non-zts-20240924/yaml.so /usr/local/lib/php/extensions/no-debug-non-zts-20240924/
COPY --from=scrypt /usr/local/lib/php/extensions/no-debug-non-zts-20240924/scrypt.so /usr/local/lib/php/extensions/no-debug-non-zts-20240924/
COPY --from=zstd /usr/local/lib/php/extensions/no-debug-non-zts-20240924/zstd.so /usr/local/lib/php/extensions/no-debug-non-zts-20240924/
COPY --from=brotli /usr/local/lib/php/extensions/no-debug-non-zts-20240924/brotli.so /usr/local/lib/php/extensions/no-debug-non-zts-20240924/
COPY --from=lz4 /usr/local/lib/php/extensions/no-debug-non-zts-20240924/lz4.so /usr/local/lib/php/extensions/no-debug-non-zts-20240924/
COPY --from=snappy /usr/local/lib/php/extensions/no-debug-non-zts-20240924/snappy.so /usr/local/lib/php/extensions/no-debug-non-zts-20240924/
COPY --from=xdebug /usr/local/lib/php/extensions/no-debug-non-zts-20240924/xdebug.so /usr/local/lib/php/extensions/no-debug-non-zts-20240924/

# Enable Extensions
RUN echo extension=swoole.so >> /usr/local/etc/php/conf.d/swoole.ini
RUN echo extension=redis.so >> /usr/local/etc/php/conf.d/redis.ini
RUN echo extension=imagick.so >> /usr/local/etc/php/conf.d/imagick.ini
RUN echo extension=yaml.so >> /usr/local/etc/php/conf.d/yaml.ini
RUN echo extension=scrypt.so >> /usr/local/etc/php/conf.d/scrypt.ini
RUN echo extension=zstd.so >> /usr/local/etc/php/conf.d/zstd.ini
RUN echo extension=brotli.so >> /usr/local/etc/php/conf.d/brotli.ini
RUN echo extension=lz4.so >> /usr/local/etc/php/conf.d/lz4.ini
RUN echo extension=snappy.so >> /usr/local/etc/php/conf.d/snappy.ini

EXPOSE 80

CMD [ "tail", "-f", "/dev/null" ]

32 changes: 32 additions & 0 deletions php-8.4/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
schemaVersion: '2.0.0'

fileExistenceTests:
## Extension files
- name: 'Check swoole extension'
path: /usr/local/lib/php/extensions/no-debug-non-zts-20240924/swoole.so
shouldExist: true
- name: 'Check redis extension'
path: /usr/local/lib/php/extensions/no-debug-non-zts-20240924/redis.so
shouldExist: true
- name: 'Check imagick extension'
path: /usr/local/lib/php/extensions/no-debug-non-zts-20240924/imagick.so
shouldExist: true
- name: 'Check yaml extension'
path: /usr/local/lib/php/extensions/no-debug-non-zts-20240924/yaml.so
shouldExist: true
- name: 'Check scrypt extension'
path: /usr/local/lib/php/extensions/no-debug-non-zts-20240924/scrypt.so
shouldExist: true
- name: 'Check zstd extension'
path: /usr/local/lib/php/extensions/no-debug-non-zts-20240924/zstd.so
shouldExist: true
- name: 'Check brotli extension'
path: /usr/local/lib/php/extensions/no-debug-non-zts-20240924/brotli.so
shouldExist: true
- name: 'Check lz4 extension'
path: /usr/local/lib/php/extensions/no-debug-non-zts-20240924/lz4.so
shouldExist: true
- name: 'Check snappy extension'
path: /usr/local/lib/php/extensions/no-debug-non-zts-20240924/snappy.so
shouldExist: true