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

8.4 upgrade #109

Merged
merged 4 commits into from
Dec 12, 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
10 changes: 10 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ jobs:
docker pull adhocore/phpfpm:8.1 || true
docker pull adhocore/phpfpm:8.2 || true
docker pull adhocore/phpfpm:8.3 || true
docker pull adhocore/phpfpm:8.4 || true

- name: "[8.4] Build and push"
id: docker_build_84
uses: docker/build-push-action@v4
with:
push: true
file: 8.4.Dockerfile
tags: adhocore/phpfpm:8.4,adhocore/phpfpm:latest
platforms: linux/amd64,linux/arm64

- name: "[8.3] Build and push"
id: docker_build_83
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build_preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: "[8.3r] Build and push"
id: docker_build_83
- name: "[8.4] Build and push"
id: docker_build_84
uses: docker/build-push-action@v4
with:
push: true
file: 8.3.Dockerfile
tags: adhocore/phpfpm:8.3r,adhocore/phpfpm:8.3rc
tags: adhocore/phpfpm:8.4,adhocore/phpfpm:8.4
platforms: linux/amd64,linux/arm64
56 changes: 56 additions & 0 deletions 8.4.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
FROM php:8.4.1-fpm-alpine3.20

MAINTAINER Jitendra Adhikari <[email protected]>

ENV \
LD_PRELOAD=/usr/lib/preloadable_libiconv.so \
PECL_EXTENSIONS="apcu ast ds ev igbinary lzf memcached mongodb msgpack oauth pcov \
psr redis rdkafka simdjson ssh2-1.3.1 uuid xdebug xhprof xlswriter yaml" \
PHP_EXTENSIONS="bcmath bz2 calendar exif gd gettext gmp imap intl ldap mysqli pcntl pdo_mysql pgsql \
pdo_pgsql pspell shmop soap sysvshm sysvmsg sysvsem tidy xsl zip" \
PECL_EXTENSIONS_FUTURE="grpc imagick yaf" \
PHP_EXTENSIONS_FUTURE="intl sockets"

# docker-*
COPY docker-* /usr/local/bin/

# copy from existing
# COPY --from=adhocore/phpfpm:8.4 /usr/local/lib/php/extensions/no-debug-non-zts-20230831/*.so /usr/local/lib/php/extensions/no-debug-non-zts-20230831/##
# COPY --from=adhocore/phpfpm:8.4 /usr/local/etc/php/conf.d/*.ini /usr/local/etc/php/conf.d/

# ext
COPY ext.php /ext.php

RUN \
# deps
apk add -U --no-cache --virtual temp \
# dev deps
autoconf g++ file re2c make zlib-dev libtool aspell-dev pcre-dev libxml2-dev bzip2-dev libzip-dev \
icu-dev gettext-dev imagemagick-dev openldap-dev libpng-dev gmp-dev yaml-dev postgresql-dev \
libxml2-dev tidyhtml-dev libmemcached-dev libssh2-dev libevent-dev libev-dev librdkafka-dev lua-dev libxslt-dev \
freetype-dev jpeg-dev libjpeg-turbo-dev oniguruma-dev \
# prod deps
&& apk add --no-cache aspell gettext gnu-libiconv grpc \
icu imagemagick libjpeg imap-dev libzip libbz2 librdkafka libxml2-utils libpq \
libmemcached libssh2 libevent libev libxslt linux-headers lua openldap \
openldap-back-mdb tidyhtml yaml zlib \
#
# php extensions
&& docker-php-source extract \
&& docker-php-ext-remove intl || true \
&& pecl channel-update pecl.php.net \
&& { php -m | grep gd || docker-php-ext-configure gd --with-freetype --with-jpeg --enable-gd; } \
&& docker-php-ext-install-if $PHP_EXTENSIONS \
&& docker-pecl-ext-install $PECL_EXTENSIONS \
&& { docker-php-ext-enable $(echo $PECL_EXTENSIONS | sed -E 's/\-[^ ]+//g') opcache > /dev/null || true; } \
&& { php -m | grep xdebug && docker-php-ext-disable xdebug || true; } \
&& docker-php-source delete \
#
# composer
&& curl -sSL https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
&& curl -sSL https://getcomposer.org/installer | php -- --1 --install-dir=/usr/local/bin --filename=composer1 \
#
# cleanup
&& apk del temp \
&& rm -rf /var/cache/apk/* /tmp/* /var/tmp/* /usr/share/doc/* /usr/share/man/* \
&& php -f /ext.php
32 changes: 28 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Check [example](#extensions) below how to add them back in your images based off

Docker PHP FPM with lean alpine base. The download size is just about **~100MB** - tiny given how many extensions it has baked in.

It contains PHP>=8.3.4, PHP>=8.2.17, PHP>=8.1.27 and PHP>=8.0.30 with plenty of common and useful extensions.
It contains PHP>=8.4.1, PHP>=8.3.4, PHP>=8.2.17, PHP>=8.1.27 and PHP>=8.0.30 with plenty of common and useful extensions.

If you are looking for a complete local development stack then check
[`adhocore/lemp`](https://github.com/adhocore/docker-lemp).
Expand All @@ -26,6 +26,9 @@ The images are always latest, everytime a new PHP version comes out and its offi
To pull latest image:

```sh
# for php >=8.4.1
docker pull adhocore/phpfpm:8.4

# for php >=8.3.4
docker pull adhocore/phpfpm:8.3

Expand Down Expand Up @@ -72,7 +75,7 @@ Latest versions of both Composer v1 and v2 are installed already. You can run v2

You can add new extensions in your image like so:
```Dockerfile
FROM adhocore/phpfpm:8.3 # or 8.2, 8.1
FROM adhocore/phpfpm:8.4 # or 8.3, 8.2

RUN \
# setup
Expand All @@ -94,6 +97,27 @@ just run `docker-php-ext-enable xdebug` to enable it again without having to reb

Below you can find list of extensions by image tags.

### PHP8.4

```
PHP 8.4.1, Total extensions: 60
- bcmath - bz2 - calendar - core
- ctype - curl - date - dom
- exif - fileinfo - filter - fpm
- ftp - gd - gettext - gmp
- hash - iconv - imap - intl
- json - ldap - libxml - mbstring
- mysqli - mysqlnd - openssl - pcntl
- pcre - pdo - pdo_mysql - pdo_pgsql
- pdo_sqlite - pgsql - phar - posix
- pspell - random - readline - reflection
- session - shmop - simplexml - soap
- sodium - spl - sqlite3 - standard
- sysvmsg - sysvsem - sysvshm - tidy
- tokenizer - xdebug - xml - xmlreader
- xmlwriter - xsl - zip - zlib
```

### PHP8.3

```
Expand Down Expand Up @@ -238,10 +262,10 @@ Read more about
### Production Usage

For production you may want to get rid of some extensions that are not really required.
In such case, you can build a custom image on top `adhocore/phpfpm:8.2` like so:
In such case, you can build a custom image on top `adhocore/phpfpm:8.4` like so:

```Dockerfile
FROM adhocore/phpfpm:8.2 # or 8.1 or 8.0
FROM adhocore/phpfpm:8.4 # or 8.3 or 8.2

# Disable extensions you won't need. You can add as much as you want separated by space.
RUN docker-php-ext-disable xdebug pcov ldap
Expand Down