Base PHP image
6.6K
A base image to build php-fpm docker images fast.
The image installs useful PHP extensions, composer and activates jit.
1] Use the FROM tag at the top of the Dockerfile, such as:
FROM dibbleops/base-php:8.1-fpm
FROM dibbleops/base-php:8.1-fpm-alpine
2] Composer is found at /usr/local/bin/composer. Usage example:
RUN /usr/local/bin/composer install --no-dev
3] The list of available PHP extensions:
| apcu | gd | opcache | session |
| bcmath | gmp* | openssl | SimpleXML |
| Core | hash | pcre | sodium |
| ctype | iconv | pcntl | SPL |
| curl | imagick* | PDO | sqlite3 |
| date | intl | pdo_sqlite | standard |
| dom | json | Phar | tokenizer |
| exif | libxml | posix | xml |
| fileinfo | mbstring | readline | xmlreader |
| filter | mysqli | redis | xmlwriter |
| ftp | mysqlnd | Reflection | zlib |
* Not in alpine image
In addition, the xdebug extension is installed but not enabled.
A new php.ini file may be copied at PHP_INI_DIR in order to override the exiting file.
COPY ./php.ini $PHP_INI_DIR
Before using pecl or docker-php-ext-* commands, add the following statement to the Dockerfile:
RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS
Then use pecl and docker-php-ext-* commands as usual, for instance:
# Install the PHP mysqli extention
RUN docker-php-ext-install mysqli && \
docker-php-ext-enable mysqli
After all such commands, cleanup with:
RUN apk del --no-network .build-deps
RUN rm -rf /tmp/* /var/tmp/*
Content type
Image
Digest
sha256:1ef150a03…
Size
58.4 MB
Last updated
6 days ago
docker pull dibbleops/base-php:8.3-fpm-alpine