Inspired by https://github.com/bobey/docker-gitlab-ci-runner - for whatever reason, I couldn't build with child images, so I decided to lump it all together and it worked. Bumped the version of PHP 5.6 to the latest stable as well.
Building your own image
git clone https://github.com/superhaggis/php5.6 cd php5.6 docker build -t superhaggis/php5.6 .
The completed image weighs in at approximately 1,115MB.
What does this image give me?
- Your choice of PHP CLI binary with these core extensions built and enabled.
- The Composer dependency management CLI tool.
- PECL extensions for MongoDB, Redis, Memcache, SSH2 and xdebug
- Stock PEAR libraries (for legacy PHP applications)
Changing PHP version
If you want to test your application earlier version of PHP, all you need to do is change the PHP_VERSION variable at the top of the Dockerfile and re-build your image. This is handled via a combination of phpenv and php-build.
ENV PHP_VERSION 5.6.10
Despite the name of this repository, you can in fact compile as far back as PHP 5.2.17, if you so desired.
A list of supported PHP versions can be found here.