Sign inSign up

frxyt/php-dev

By frxyt

•Updated over 2 years ago

Docker Image for PHP development, by FEROX

Image
0

9.6K

frxyt/php-dev repository overview

⁠Docker Image for PHP development, by FEROX⁠

Docker Cloud Automated build Docker Cloud Build Status Docker Pulls GitHub issues GitHub last commit

Use this image to increase your development speed. No need to create your own Dockerfile, just ask this image to install missing packages and extensions on runtime through your docker-compose.yml !

This image is able to install Debian packages, PHP extensions (and configure them), enable Apache modules, with only the use of environment variables. So, no need to create a Dockerfile for your develpment environment anymore. It comes with Composer, Node.js, Xdebug, and Yarn too. This image is also capable of highly increase performances on Docker for Mac/Windows too by enabling a cache for composer vendor path.

⁠Docker Hub Image

frxyt/php-dev

⁠Tags

PHP versionCLI onlyWith ApacheWith php-fpm
5.65.6-cli5.6-apache5.6-fpm
7.07.0-cli7.0-apache7.0-fpm
7.17.1-cli7.1-apache7.1-fpm
7.27.2-cli7.2-apache7.2-fpm
7.37.3-cli7.3-apache7.3-fpm
7.47.4-cli7.4-apache, latest7.4-fpm
8.08.0-cli8.0-apache8.0-fpm

⁠Tools

⁠Variables

⁠Configurable environment variables

These environment variables can be overriden to change the default behavior of the image and adapt it to your needs:

NameTypeExampleDescription
FRX_APACHE_ENABLE_MODstringrewriteEnable Apache module, module names can be separated by spaces or new lines.
FRX_APACHE_DOCUMENT_ROOTstring/var/www/html/publicChange Apache document root.
FRX_APT_GET_INSTALLstringlibfreetype6-dev libgd-dev libjpeg62-turbo-dev libpng-devInstall Debian packages, package names can be separated by spaces or new lines.
FRX_COMPOSER_VENDOR_CACHE_ENABLEinteger0 (Off) / 1 (On)Enable or disable cache for composer vendor path, defaults to 0.
FRX_COMPOSER_VENDOR_CACHE_PATHstringvendor, app/vendorSet the path of composer vendor path to cache.
FRX_PECL_INSTALLstringxdebugInstall PECL extension, extension names can be separated by spaces or new lines.
FRX_PHP_EXT_CONFIGUREstringgd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/Configure PHP extension, multiple configurations can be separated by new lines.
FRX_PHP_EXT_ENABLEstringxdebugEnable PHP extension, extension names can be separated by spaces or new lines.
FRX_PHP_EXT_INSTALLstringgdInstall PHP extension, extension names can be separated by spaces or new lines.
FRX_PHP_INIstringdate.timezone = "Europe/Paris"Add settings to php.ini, multiple settings can be separated by new lines.
FRX_PHP_TIDEWAYS_XHPROF_CLOCK_USE_RDTSCinteger0 (Off) / 1 (On)Enable or disable the use of TSC clock for Tideways XHProf, defaults to 0.
FRX_PHP_XDEBUG_MAX_NESTING_LEVELinteger256Max PHP call nested level used by Xdebug, defaults to -1 (disabled).
FRX_PHP_XDEBUG_REMOTE_AUTOSTARTinteger0 (Off) / 1 (On)Enable or disable Xdebug remote auto connect functionnality, defaults to 1.
FRX_PHP_XDEBUG_REMOTE_CONNECT_BACKinteger0 (Off) / 1 (On)Enable or disable Xdebug remote connect back functionnality, defaults to 0.
FRX_PHP_XDEBUG_REMOTE_ENABLEinteger0 (Off) / 1 (On)Enable or disable Xdebug remote functionnality, defaults to 1.
FRX_PHP_XDEBUG_REMOTE_HOSTstring172.17.0.1Set remote IP address for Xdebug, defaults to Docker host IP address.
FRX_PHP_XDEBUG_REMOTE_PORTinteger9000Set remote port number for Xdebug, defaults to 9000.
FRX_SCRIPT_STARTstring chown www-data:www-data -R .Execute a script on container startup, one instruction per line.
⁠Readonly environment variables

Additionnaly, this image exposes some readonly variable that can be used in derived images:

NameTypeExampleDescription
FRX_DOCKER_FROMstringphp:7.3-apacheBase official PHP image used to build the image.
FRX_DOCKER_STARTEDinteger-1 (error) / 0 (starting) / 1 (started)Indicate if the container is ready or not.

⁠Example

To install PHP extension gd, you can use this sample docker-compose.yml file:

php:
  image: frxyt/php-dev:latest
  environment:
    - |
      FRX_APT_GET_INSTALL=
      libfreetype6-dev
      libgd-dev
      libjpeg62-turbo-dev
      libpng-dev
    - |
      FRX_PHP_EXT_CONFIGURE=
      gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
    - |
      FRX_PHP_EXT_INSTALL=
      gd
  ports:
    - 127.0.0.1:80:80
  volumes:
    - ./:/var/www/html:rw

To use this image with Symfony, you can simply use this sample docker-compose.yml file:

version: '3'

networks:
  backend:

services:

  mysql:
    image: mysql:5.7
    environment:
      - MYSQL_ROOT_PASSWORD=TBD
      - MYSQL_DATABASE=TBD
      - MYSQL_USER=TBD
      - MYSQL_PASSWORD=TBD
    networks:
      - backend
    volumes:
      - ./var/lib/mysql:/var/lib/mysql:rw

  php:
    image: frxyt/php-dev:latest
    depends_on:
      - mysql
    environment:
      - FRX_PHP_EXT_INSTALL=pcntl pdo_mysql
      - FRX_APACHE_ENABLE_MOD=rewrite
      - FRX_APACHE_DOCUMENT_ROOT=/var/www/html/public
      - FRX_COMPOSER_VENDOR_CACHE_ENABLE=1
      - FRX_SCRIPT_START=chown www-data:www-data -R var
    networks:
      - backend
    ports:
      - 127.0.0.1:80:80
    volumes:
      - ./:/var/www/html:rw,cached
      - ./vendor:/frx/composer/vendor:rw
      - cache:/var/www/html/var/cache
      - vendor:/var/www/html/vendor

volumes:
  cache:
  vendor:

⁠Build

docker build -f ./php5.6/Dockerfile-apache -t frxyt/php-dev:5.6-apache .
docker build -f ./php5.6/Dockerfile-cli    -t frxyt/php-dev:5.6-cli    .
docker build -f ./php5.6/Dockerfile-fpm    -t frxyt/php-dev:5.6-fpm    .

docker build -f ./php7.0/Dockerfile-apache -t frxyt/php-dev:7.0-apache .
docker build -f ./php7.0/Dockerfile-cli    -t frxyt/php-dev:7.0-cli    .
docker build -f ./php7.0/Dockerfile-fpm    -t frxyt/php-dev:7.0-fpm    .

docker build -f ./php7.1/Dockerfile-apache -t frxyt/php-dev:7.1-apache .
docker build -f ./php7.1/Dockerfile-cli    -t frxyt/php-dev:7.1-cli    .
docker build -f ./php7.1/Dockerfile-fpm    -t frxyt/php-dev:7.1-fpm    .

docker build -f ./php7.2/Dockerfile-apache -t frxyt/php-dev:7.2-apache .
docker build -f ./php7.2/Dockerfile-cli    -t frxyt/php-dev:7.2-cli    .
docker build -f ./php7.2/Dockerfile-fpm    -t frxyt/php-dev:7.2-fpm    .

docker build -f ./php7.3/Dockerfile-apache -t frxyt/php-dev:7.3-apache .
docker build -f ./php7.3/Dockerfile-cli    -t frxyt/php-dev:7.3-cli    .
docker build -f ./php7.3/Dockerfile-fpm    -t frxyt/php-dev:7.3-fpm    .

docker build -f ./php7.4/Dockerfile-apache -t frxyt/php-dev:7.4-apache .
docker build -f ./php7.4/Dockerfile-cli    -t frxyt/php-dev:7.4-cli    .
docker build -f ./php7.4/Dockerfile-fpm    -t frxyt/php-dev:7.4-fpm    .

docker build -f ./php8.0/Dockerfile-apache -t frxyt/php-dev:8.0-apache .
docker build -f ./php8.0/Dockerfile-cli    -t frxyt/php-dev:8.0-cli    .
docker build -f ./php8.0/Dockerfile-fpm    -t frxyt/php-dev:8.0-fpm    .

⁠License

This project and images are published under the MIT License⁠.

MIT License

Copyright (c) 2019-2020 FEROX YT EIRL, www.ferox.yt <[email protected]>
Copyright (c) 2019-2020 Jérémy WALTHER <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Tag summary

Content type

Image

Digest

sha256:696be3b1c…

Size

223.2 MB

Last updated

over 2 years ago

docker pull frxyt/php-dev:7.2-fpm-buster