mirror of
https://github.com/chialab/docker-php.git
synced 2026-08-24 02:24:16 -05:00
Merge pull request #90 from chialab/feat/xhprof-tag
Feat: XHProf image tag
This commit is contained in:
@@ -50,6 +50,16 @@ jobs:
|
||||
tags: chialab/php-dev:${{ matrix.version }}${{ matrix.flavor }}
|
||||
load: true
|
||||
|
||||
- name: Build xhprof image for testing
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
cache-to: type=inline
|
||||
context: ./xhprof
|
||||
build-args: |
|
||||
BASE_IMAGE=${{ matrix.version }}${{ matrix.flavor }}
|
||||
tags: chialab/php-xhprof:${{ matrix.version }}${{ matrix.flavor }}
|
||||
load: true
|
||||
|
||||
- name: Test images
|
||||
env:
|
||||
VERSION: ${{ matrix.version }}${{ matrix.flavor }}
|
||||
@@ -88,3 +98,15 @@ jobs:
|
||||
BASE_IMAGE=${{ matrix.version }}${{ matrix.flavor }}
|
||||
tags: chialab/php-dev:${{ matrix.version }}${{ matrix.flavor }}
|
||||
push: true
|
||||
|
||||
- name: Build xhprof image and push to registry
|
||||
if: "github.event_name != 'pull_request'"
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
platforms: linux/amd64,linux/arm64
|
||||
cache-to: type=inline
|
||||
context: ./xhprof
|
||||
build-args: |
|
||||
BASE_IMAGE=${{ matrix.version }}${{ matrix.flavor }}
|
||||
tags: chialab/php-xhprof:${{ matrix.version }}${{ matrix.flavor }}
|
||||
push: true
|
||||
|
||||
@@ -20,9 +20,9 @@
|
||||
|
||||
Docker images built on top of the [official PHP images](https://hub.docker.com/r/_/php/) with the addition of some common and useful extensions, installed with [mlocati/docker-php-extension-installer](https://github.com/mlocati/docker-php-extension-installer). You can find these images on the [Docker Hub](https://hub.docker.com/r/chialab/php/) (and if you're reading this file, you're probably already there).
|
||||
|
||||
An automated build is set up, so they should be always up-to-date with the Dockerfiles in the [GitHub repository](https://github.com/Chialab/docker-php). Also, every time an official PHP image is updated, a rebuild is triggered, so that you will always find the latest security patches installed in these images.
|
||||
An automated build is set up, so they should be always up-to-date with the Dockerfiles in the [GitHub repository](https://github.com/chialab/docker-php). Also, every time an official PHP image is updated, a rebuild is triggered, so that you will always find the latest security patches installed in these images.
|
||||
|
||||
For development environments, you might want to choose an [image with XDebug installed](https://hub.docker.com/r/chialab/php-dev/), instead.
|
||||
For development environments, you might want to choose an [image with XDebug installed](https://hub.docker.com/r/chialab/php-dev/), or [one with XHProf](https://hub.docker.com/r/chialab/php-xhprof/), instead.
|
||||
|
||||
## Available tags
|
||||
- `latest`
|
||||
@@ -48,7 +48,7 @@ For development environments, you might want to choose an [image with XDebug ins
|
||||
- `8.0-apache`
|
||||
- `8.0-fpm`
|
||||
|
||||
As you might have guessed, all tags are built on top of the corresponding tag of the official image. Not all tags are supported in order to easen manteinance.
|
||||
As you might have guessed, all tags are built on top of the corresponding tag of the official image. Not all tags are supported in order to easen maintenance.
|
||||
|
||||
## Installed extensions
|
||||
The following modules and extensions have been enabled,
|
||||
@@ -58,9 +58,9 @@ in addition to those you can already find in the [official PHP image](https://hu
|
||||
- `bz2`
|
||||
- `calendar`
|
||||
- `exif`
|
||||
- `gd`
|
||||
- `iconv`
|
||||
- `intl`
|
||||
- `gd`
|
||||
- `ldap`
|
||||
- `mbstring`
|
||||
- `mcrypt` (_only PHP ≤ 7.1_)
|
||||
@@ -72,10 +72,10 @@ in addition to those you can already find in the [official PHP image](https://hu
|
||||
- `pgsql`
|
||||
- `redis`
|
||||
- `soap`
|
||||
- `sockets`
|
||||
- `xsl`
|
||||
- `Zend OPcache`
|
||||
- `zip`
|
||||
- `sockets`
|
||||
|
||||
You will probably not need all this stuff. Even if having some extra extensions loaded ain't a big issue in most cases, you will very likely want to checkout this repository, remove unwanted extensions from the `Dockerfile`, and build your own image — for sometimes removing is easier than adding. 😉
|
||||
|
||||
|
||||
+27
-7
@@ -1,10 +1,26 @@
|
||||
# Docker PHP images
|
||||
[](https://travis-ci.org/Chialab/docker-php)
|
||||
[](https://hub.docker.com/r/chialab/php-dev/)
|
||||
<p align="center">
|
||||
<a href="https://www.chialab.io/p/docker-php">
|
||||
<img alt="Docker PHP Images logo" width="144" height="144" src="https://raw.githack.com/chialab/docker-php/master/logo.svg" />
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<strong>Docker PHP images</strong>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/chialab/docker-php/actions"><img alt="GitHub Workflow Status" src="https://img.shields.io/github/workflow/status/chialab/docker-php/Build,%20test%20and%20publish%20images?style=flat-square"></a>
|
||||
<a href="https://github.com/chialab/docker-php"><img alt="Source link" src="https://img.shields.io/badge/Source-GitHub-lightgrey.svg?style=flat-square"></a>
|
||||
<a href="https://www.chialab.it"><img alt="Authors link" src="https://img.shields.io/badge/Authors-Chialab-lightgrey.svg?style=flat-square"></a>
|
||||
<a href="https://hub.docker.com/r/chialab/php-dev/"><img alt="Docker Pulls" src="https://img.shields.io/docker/pulls/chialab/php-dev.svg?style=flat-square"></a>
|
||||
<a href="https://github.com/chialab/docker-php/blob/master/LICENSE"><img alt="License" src="https://img.shields.io/github/license/chialab/docker-php.svg?style=flat-square"></a>
|
||||
</p>
|
||||
|
||||
---
|
||||
|
||||
Docker images built on top of the [official PHP images](https://hub.docker.com/r/_/php/) with the addition of some common and useful extensions, installed with [mlocati/docker-php-extension-installer](https://github.com/mlocati/docker-php-extension-installer), and are meant for *debugging purposes*. You can find these images on the [Docker Hub](https://hub.docker.com/r/chialab/php-dev/) (and if you're reading this file, you're probably already there).
|
||||
|
||||
An automated build is set up, so they should be always up-to-date with the Dockerfiles in the [GitHub repository](https://github.com/Chialab/docker-php). Also, every time an official PHP image is updated, a rebuild is triggered, so that you will always find the latest security patches installed in these images.
|
||||
An automated build is set up, so they should be always up-to-date with the Dockerfiles in the [GitHub repository](https://github.com/chialab/docker-php). Also, every time an official PHP image is updated, a rebuild is triggered, so that you will always find the latest security patches installed in these images.
|
||||
|
||||
For more production-like environments, you might want to choose an [image *without* XDebug installed](https://hub.docker.com/r/chialab/php/), instead.
|
||||
|
||||
@@ -28,8 +44,11 @@ For more production-like environments, you might want to choose an [image *witho
|
||||
- `7.4`
|
||||
- `7.4-apache`
|
||||
- `7.4-fpm`
|
||||
- `8.0`
|
||||
- `8.0-apache`
|
||||
- `8.0-fpm`
|
||||
|
||||
As you might have guessed, all tags are built on top of the corresponding tag of the official image. Not all tags are supported in order to easen manteinance.
|
||||
As you might have guessed, all tags are built on top of the corresponding tag of the official image. Not all tags are supported in order to easen maintenance.
|
||||
|
||||
## Installed extensions
|
||||
The following modules and extensions have been enabled,
|
||||
@@ -39,9 +58,9 @@ in addition to those you can already find in the [official PHP image](https://hu
|
||||
- `bz2`
|
||||
- `calendar`
|
||||
- `exif`
|
||||
- `gd`
|
||||
- `iconv`
|
||||
- `intl`
|
||||
- `gd`
|
||||
- `ldap`
|
||||
- `mbstring`
|
||||
- `mcrypt` (_only PHP ≤ 7.1_)
|
||||
@@ -53,8 +72,9 @@ in addition to those you can already find in the [official PHP image](https://hu
|
||||
- `pgsql`
|
||||
- `redis`
|
||||
- `soap`
|
||||
- `xsl`
|
||||
- `sockets`
|
||||
- `xdebug`
|
||||
- `xsl`
|
||||
- `Zend OPcache`
|
||||
- `zip`
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
ARG BASE_IMAGE=latest
|
||||
FROM chialab/php:${BASE_IMAGE}
|
||||
LABEL maintainer="dev@chialab.io"
|
||||
|
||||
# Install XHProf.
|
||||
RUN install-php-extensions xhprof
|
||||
@@ -0,0 +1,90 @@
|
||||
SHELL := /bin/bash
|
||||
ALL: build
|
||||
.PHONY: build test push
|
||||
|
||||
PARENT_IMAGE := chialab/php
|
||||
IMAGE := chialab/php-xhprof
|
||||
VERSION ?= latest
|
||||
PHP_VERSION = $(firstword $(subst -, ,$(VERSION)))
|
||||
|
||||
# Extensions.
|
||||
EXTENSIONS := \
|
||||
bcmath \
|
||||
bz2 \
|
||||
calendar \
|
||||
exif \
|
||||
gd \
|
||||
iconv \
|
||||
intl \
|
||||
ldap \
|
||||
mbstring \
|
||||
memcached \
|
||||
mysqli \
|
||||
OPcache \
|
||||
pdo_mysql \
|
||||
pdo_pgsql \
|
||||
pgsql \
|
||||
redis \
|
||||
soap \
|
||||
sockets \
|
||||
xhprof \
|
||||
xsl \
|
||||
zip
|
||||
ifeq (,$(findstring $(PHP_VERSION), 7.2 7.3 7.4 8.0 latest))
|
||||
# Add more extensions to PHP < 7.2.
|
||||
EXTENSIONS += mcrypt
|
||||
endif
|
||||
ifeq (,$(findstring $(PHP_VERSION), 7.0 7.1 7.2 7.3 7.4 8.0 latest))
|
||||
# Add more extensions to 5.x series images.
|
||||
EXTENSIONS += mysql
|
||||
endif
|
||||
|
||||
build:
|
||||
@echo " =====> Building $(IMAGE):$(VERSION)..."
|
||||
docker image build --quiet --build-arg 'BASE_IMAGE=$(VERSION)' -t $(IMAGE):$(VERSION) .
|
||||
|
||||
test:
|
||||
@echo -e "=====> Testing loaded extensions... \c"
|
||||
@if [[ -z `docker image ls $(IMAGE) | grep "\s$(VERSION)\s"` ]]; then \
|
||||
echo 'FAIL [Missing image!!!]'; \
|
||||
exit 1; \
|
||||
fi
|
||||
@IMAGE_PHP_VERSION=`docker container run --rm $(IMAGE):$(VERSION) bash -c '/bin/echo $$PHP_VERSION' | cut -d '.' -f 1,2`; \
|
||||
if [[ "$(PHP_VERSION)" != "latest" && "$${IMAGE_PHP_VERSION}" != "$(PHP_VERSION)" ]]; then \
|
||||
echo "FAIL [wrong PHP version: expected $(PHP_VERSION), got $${IMAGE_PHP_VERSION}]"; \
|
||||
exit 1; \
|
||||
fi
|
||||
@modules=`docker container run --rm $(IMAGE):$(VERSION) php -m`; \
|
||||
for ext in $(EXTENSIONS); do \
|
||||
if [[ "$${modules}" != *"$${ext}"* ]]; then \
|
||||
echo "FAIL [$${ext}]"; \
|
||||
exit 1; \
|
||||
fi \
|
||||
done
|
||||
@if [[ "$(VERSION)" == *'-apache' ]]; then \
|
||||
apache=`docker container run --rm $(IMAGE):$(VERSION) apache2ctl -M 2> /dev/null`; \
|
||||
if [[ "$${apache}" != *'rewrite_module'* ]]; then \
|
||||
echo 'FAIL [mod_rewrite]'; \
|
||||
exit 1; \
|
||||
fi \
|
||||
fi
|
||||
@if [[ -z `docker container run --rm $(IMAGE):$(VERSION) composer --version 2> /dev/null | grep '^Composer version 2\.[0-9][0-9]*'` ]]; then \
|
||||
echo 'FAIL [Composer 2]'; \
|
||||
exit 1; \
|
||||
fi
|
||||
@if [[ -z `docker container run --rm $(IMAGE):$(VERSION) composer2 --version 2> /dev/null | grep '^Composer version 2\.[0-9][0-9]*'` ]]; then \
|
||||
echo 'FAIL [Composer 2]'; \
|
||||
exit 1; \
|
||||
fi
|
||||
@if [[ -z `docker container run --rm $(IMAGE):$(VERSION) composer1 --version 2> /dev/null | grep '^Composer version 1\.[0-9][0-9]*'` ]]; then \
|
||||
echo 'FAIL [Composer 1]'; \
|
||||
exit 1; \
|
||||
fi
|
||||
@if [[ -z `docker container run --rm $(IMAGE):$(VERSION) composer1 global show 2> /dev/null | grep '^hirak/prestissimo [0-9][0-9]*\.[0-9][0-9]*'` ]]; then \
|
||||
echo 'FAIL [Composer 1 plugin - prestissimo]'; \
|
||||
exit 1; \
|
||||
fi
|
||||
@echo 'OK'
|
||||
|
||||
push:
|
||||
docker image push $(IMAGE):$(VERSION)
|
||||
@@ -0,0 +1,109 @@
|
||||
<p align="center">
|
||||
<a href="https://www.chialab.io/p/docker-php">
|
||||
<img alt="Docker PHP Images logo" width="144" height="144" src="https://raw.githack.com/chialab/docker-php/master/logo.svg" />
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<strong>Docker PHP images</strong>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/chialab/docker-php/actions"><img alt="GitHub Workflow Status" src="https://img.shields.io/github/workflow/status/chialab/docker-php/Build,%20test%20and%20publish%20images?style=flat-square"></a>
|
||||
<a href="https://github.com/chialab/docker-php"><img alt="Source link" src="https://img.shields.io/badge/Source-GitHub-lightgrey.svg?style=flat-square"></a>
|
||||
<a href="https://www.chialab.it"><img alt="Authors link" src="https://img.shields.io/badge/Authors-Chialab-lightgrey.svg?style=flat-square"></a>
|
||||
<a href="https://hub.docker.com/r/chialab/php-xhprof/"><img alt="Docker Pulls" src="https://img.shields.io/docker/pulls/chialab/php-xhprof.svg?style=flat-square"></a>
|
||||
<a href="https://github.com/chialab/docker-php/blob/master/LICENSE"><img alt="License" src="https://img.shields.io/github/license/chialab/docker-php.svg?style=flat-square"></a>
|
||||
</p>
|
||||
|
||||
---
|
||||
|
||||
Docker images built on top of the [official PHP images](https://hub.docker.com/r/_/php/) with the addition of some common and useful extensions, installed with [mlocati/docker-php-extension-installer](https://github.com/mlocati/docker-php-extension-installer), and are meant for *profiling purposes*. You can find these images on the [Docker Hub](https://hub.docker.com/r/chialab/php-xhprof/) (and if you're reading this file, you're probably already there).
|
||||
|
||||
An automated build is set up, so they should be always up-to-date with the Dockerfiles in the [GitHub repository](https://github.com/chialab/docker-php). Also, every time an official PHP image is updated, a rebuild is triggered, so that you will always find the latest security patches installed in these images.
|
||||
|
||||
For more production-like environments, you might want to choose an [image *without* XHProf installed](https://hub.docker.com/r/chialab/php/), instead.
|
||||
|
||||
## Available tags
|
||||
- `latest`
|
||||
- `5.6`
|
||||
- `5.6-apache`
|
||||
- `5.6-fpm`
|
||||
- `7.0`
|
||||
- `7.0-apache`
|
||||
- `7.0-fpm`
|
||||
- `7.1`
|
||||
- `7.1-apache`
|
||||
- `7.1-fpm`
|
||||
- `7.2`
|
||||
- `7.2-apache`
|
||||
- `7.2-fpm`
|
||||
- `7.3`
|
||||
- `7.3-apache`
|
||||
- `7.3-fpm`
|
||||
- `7.4`
|
||||
- `7.4-apache`
|
||||
- `7.4-fpm`
|
||||
- `8.0`
|
||||
- `8.0-apache`
|
||||
- `8.0-fpm`
|
||||
|
||||
As you might have guessed, all tags are built on top of the corresponding tag of the official image. Not all tags are supported in order to easen maintenance.
|
||||
|
||||
## Installed extensions
|
||||
The following modules and extensions have been enabled,
|
||||
in addition to those you can already find in the [official PHP image](https://hub.docker.com/r/_/php/):
|
||||
|
||||
- `bcmath`
|
||||
- `bz2`
|
||||
- `calendar`
|
||||
- `exif`
|
||||
- `gd`
|
||||
- `iconv`
|
||||
- `intl`
|
||||
- `ldap`
|
||||
- `mbstring`
|
||||
- `mcrypt` (_only PHP ≤ 7.1_)
|
||||
- `memcached`
|
||||
- `mysql` (_only PHP 5.x_)
|
||||
- `mysqli`
|
||||
- `pdo_mysql`
|
||||
- `pdo_pgsql`
|
||||
- `pgsql`
|
||||
- `redis`
|
||||
- `soap`
|
||||
- `sockets`
|
||||
- `xhprof`
|
||||
- `xsl`
|
||||
- `Zend OPcache`
|
||||
- `zip`
|
||||
|
||||
You will probably not need all this stuff. Even if having some extra extensions loaded ain't a big issue in most cases (especially in a development environment), you will very likely want to checkout this repository, remove unwanted extensions from the `Dockerfile`, and build your own image — for sometimes removing is easier than adding. 😉
|
||||
|
||||
## Composer
|
||||
[Composer](https://getcomposer.org) is installed globally in all images. Please, refer to their documentation for usage hints.
|
||||
[Prestissimo (composer plugin)](https://github.com/hirak/prestissimo) is installed globally in all images. Plugin that downloads packages in parallel to speed up the installation process of Composer packages.
|
||||
|
||||
## Configuring XHProf
|
||||
Look at [XHProf documentation](https://www.php.net/manual/en/xhprof.configuration.php) for additional configurations.
|
||||
You will need to pass these configurations via Apache or Nginx configuration files.
|
||||
|
||||
### Using Apache
|
||||
Specify additional options via `php_value`, e.g.:
|
||||
|
||||
```
|
||||
php_value xhprof.output_dir /home/me/xhprof
|
||||
```
|
||||
|
||||
### Using Nginx
|
||||
Parameters must be passed to the FastCGI PHP interpreter via `fastcgi_param`, e.g.:
|
||||
|
||||
```
|
||||
fastcgi_param PHP_VALUE "xhprof.output_dir=/home/me/xhprof";c
|
||||
|
||||
```
|
||||
|
||||
## Contributing
|
||||
If you find an issue, or have a special wish not yet fulfilled, please [open an issue on GitHub](https://github.com/Chialab/docker-php/issues) providing as many details as you can (the more you are specific about your problem, the easier it is for us to fix it).
|
||||
|
||||
Pull requests are welcome, too! 😁 Please, run `make build` and `make test` before attempting a pull request. Also, it would be nice if you could follow [best practices for writing Dockerfiles](https://docs.docker.com/articles/dockerfile_best-practices/).
|
||||
Reference in New Issue
Block a user