Sign inSign up

virtuasa/php

By virtuasa

•Updated over 4 years ago

PHP web development docker images used by Virtua SA.

Image
1

10K+

virtuasa/php repository overview

Build Status

⁠Virtua Docker Image - PHP

These images are built and published on VirtuaSA Docker Hub⁠.

⁠Build

  • Run the script ./docker-build.sh:
    • ./docker-build.sh <PHP_VERSION>
    • ./docker-build.sh all
  • Images can be pushed from GitlabCI if all tests are OK

⁠Images content

Tags (virtuasa/php:)⁠5.25.35.45.55.67.07.17.27.37.4
PHP (php)⁠5.2.65.3.35.4.455.5.605.6.407.0.337.1.337.2.297.3.167.4.4
Behat (behat)⁠✔✔✔✔✔✔✔
Composer (composer)⁠✔✔✔✔✔✔✔✔✔
DbUnit (dbunit)⁠✔✔✔✔✔
Phing (phing)⁠✔✔✔✔✔✔✔✔✔
PHP_CodeSniffer (phpcs, phpcbf)⁠✔✔✔✔✔✔✔✔
PHP Copy/Paste Detector (phpcpd)⁠✔✔✔✔✔✔
PHP_Depend (pdepend)⁠✔✔✔✔✔✔✔✔✔
PHP Coding Standards Fixer (php-cs-fixer)⁠2.2.202.2.202.14.0+2.14.0+2.14.0+2.14.0+2.14.0+2.14.0+
PHP Static Analysis Tool (phpstan)⁠0.9.20.10.3+0.10.3+0.10.3+0.10.3+
PhpDocumentor (phpdoc)⁠✔✔✔✔✔✔✔✔
PhpDox (phpdox)⁠0.8.1.10.9.00.11.20.11.20.11.2✔✔✔✔
PHPLOC (phploc)⁠✔✔✔✔✔✔
PhpMetrics (phpmetrics)⁠✔✔✔✔✔✔✔✔
PHP Mess Detector (phpmd)⁠✔✔✔✔✔✔✔✔✔
PHPUnit (Current Stable Release) (phpunit)⁠✔✔✔
PHPUnit 7.5+ (phpunit75)⁠✔✔✔✔
PHPUnit 6.2+ (phpunit62)⁠✔✔✔✔✔
PHPUnit 5.7+ (phpunit57)⁠✔✔✔✔✔✔
PHPUnit 4.8+ (phpunit48)⁠✔✔✔✔✔✔✔✔✔
Node.js (node, npm)⁠6.9.16.9.16.9.18.9.08.9.08.9.08.9.08.9.0
Bower (bower)⁠✔✔✔✔✔✔✔✔
Gulp (gulp)⁠✔✔✔✔✔✔✔✔
Grunt (grunt)⁠✔✔✔✔✔✔✔✔
PM2 (pm2)⁠✔✔✔✔✔✔✔✔
Webpack (webpack)⁠✔✔✔✔✔✔✔✔
XHGUI (xhgui)⁠✔✔✔✔✔✔✔
Yarn (yarn)⁠✔✔✔✔✔✔✔✔
Apache⁠2.2.92.2.162.2.222.2.222.4.102.4.252.4.252.4.252.4.382.4.38
NGINX⁠0.6.320.7.671.2.11.2.11.6.21.10.31.10.31.10.31.14.21.14.2
SSMTP⁠2.642.642.642.642.642.642.642.642.642.64
Debian⁠lennysqueezewheezywheezyjessiestretchstretchstretchbusterbuster

To customize these setup on your projects, changes must only be done to file docker-compose.yml⁠.

Apache calls PHP with mod_php. Nginx calls PHP with php-fpm

⁠Usage

⁠Customizable environment variables

These variable are used on runtime and can change the default behavior of the images. Their value can be changed in docker-compose.yml file.

Variable nameDefault valueDescription
HOSTNAME_LOCAL_ALIAS``List of hosts names alias for machine resolved to 127.0.0.1, separator is coma
APACHE_DOCUMENT_ROOTwebPath to the Apache document root folder *
APACHE_LOG_PATHvar/logs/apachePath of the website Apache log folder *
APACHE_RUN_GROUPdockerGroup of user running Apache
APACHE_RUN_USERdockerUser running Apache
APACHE_SERVER_ADMINwebmaster@localhostApache server administrator email address
APACHE_SERVER_NAMElocalhostApache server name
APACHE_SSL_CERT_KEY/etc/ssl/private/ssl-cert-snakeoil.keyPrivate key used by Apache for SSL **
APACHE_SSL_CERT_PEM/etc/ssl/certs/ssl-cert-snakeoil.pemPublic key used by Apache for SSL **
DOCKER_BASE_DIR/dataDocker mount path inside the container **
DOCKER_CHMOD_666 (empty)Execute a chmod 666 on given files if set *
DOCKER_CHMOD_777 (empty)Execute a chmod 777 on given files if set *
DOCKER_CHMOD_R666 (empty)Execute a chmod -R 666 on given files if set *
DOCKER_CHMOD_R777 (empty)Execute a chmod -R 777 on given files if set *
DOCKER_COPY_CONFIG_FROM_HOSTfalseCopy the configuration files from the setup folder on the host if set to true
DOCKER_COPY_CONFIG_TO_HOSTfalseCopy the configuration files to the setup folder on the host if set to true
DOCKER_COPY_IP_TO_HOSTfalseCopy the container's ip to the setup folder on the host if set to true
DOCKER_CUSTOM_INITdocker-init.shExecute script before doing anything else *
DOCKER_CUSTOM_STARTdocker-start.shExecute script just before starting web server *
DOCKER_CUSTOM_STOPdocker-stop.shExecute script before shutting down *
DOCKER_DEBUG (empty)Enable debug output if any value is set
DOCKER_HOST_SETUP_DIRsetupPath of the setup configuration files on the host *
DOCKER_MKDIR (empty)Create requested directories using mkdir -p if set *
FIXUID1000docker user UID (see id -u in you host) must be set to UID of the developer ***
FIXGID1000docker user GID (see id -g in you host) must be set to GID of the developer ***
DOCKER_TIMEZONEEurope/ZurichTime zone of the Docker container
DOCKER_WEB_SERVERapacheWeb server to use, can be either apache or nginx
NGINX_DOCUMENT_ROOTwebPath to the Nginx document root folder *
NGINX_LOG_PATHvar/logs/nginxPath of the website Nginx log folder *
NGINX_RUN_GROUPdockerGroup of user running Nginx
NGINX_RUN_USERdockerUser running Nginx
PHP_LOG_PATHvar/logs/phpPath of the PHP log folder *
PHP_MEMORY_LIMIT_APACHE128MMaximum amount of memory a PHP script running on Apache may consume
PHP_MEMORY_LIMIT_CLI512MMaximum amount of memory a PHP script running on CLI may consume
PHP_XDEBUG_APACHE_AUTOSTART0Force activation of PHP XDebug on Apache if set to 1
PHP_XDEBUG_CLI_AUTOSTART0Force activation of PHP XDebug on CLI if set to 1
SSMTP_MAILHUBsmtp.dockerThe host to send mail to, in the form host IP_addr[:port]. The default port is 25.
SSMTP_AUTH_USER (empty)The user name to use for SMTP AUTH. The default is blank, in which case SMTP AUTH is not used. sent without
SSMTP_AUTH_PASS (empty)The password to use for SMTP AUTH.
SSMTP_AUTH_METHOD (empty)The authorization method to use. If unset, plain text is used. May also be set to “cram-md5”.
SSMTP_USE_TLS (empty)Specifies whether ssmtp uses TLS to talk to the SMTP server. The default is “no”.
SSMTP_USE_STARTTLS (empty)Specifies whether ssmtp does a EHLO/STARTTLS before starting SSL negotiation. See RFC 2487.
SSMTP_SENDER_ROOT (empty)The user that gets all mail for userids less than 1000. If blank, address rewriting is disabled.
SSMTP_SENDER_HOSTNAME (empty)The full qualified name of the host. If not specified, the host is queried for its hostname.
SSMTP_REWRITE_DOMAIN (empty)The domain from which mail seems to come. for user authentication.
SSMTP_FROM_LINE_OVERRIDE (empty)Specifies whether the From header of an email, if any, may override the default domain. The default is no.
XHGUI_ACTIVEfalseActivate of Tideways profiling if set to true
XHGUI_DB_ENSUREfalseEnsure MongoDB database creation and configuration if set to true
XHGUI_DB_HOST (empty)MongoDB database host to store the profiles
XHGUI_DB_NAME (empty)MongoDB database name to store the profiles
XHGUI_SERVER_NAMExhgui.localhostXHGUI Apache server name
COMPOSER_AUTO_INSTALLfalseAutomatic composer install, on start container if true
NPM_AUTO_INSTALLfalseAutomatic npm install, on start container if true

* Path is relative to the Docker container mount path, i.e., to the root of the project.

** Path is absolute in the Docker container, don't forget to add the path of the mount path if needed.

*** FIXUID and FIXGID must be set globaly host side.

⁠FIXUID and FIXGID

If you host linux user don't have the id 1000 (check with id), please set the globals variables to your session :

   printf "FIXUID=`id -u`\nFIXGID=`id -g`" >> ~/.profile

When using docker-compose file, set user parameter for the container like that :

    user: ${FIXUID:-1000}:${FIXGID:-1000}
⁠Special Extra Tools

List of extra command line tools, not exhaustive :

CommandDescription
xdisableXDebug Disable completely on the container, for performance purpose (http and cli)
xenableXDebug Enable completely on the container, for debug purpose (http and cli)
php_xdebugRun a PHP CLI command with XDebug active
php_no_xdebugRun a PHP CLI command without extension XDebug
doctrineCalleo Applications ONLY alias of bin/doctrine.php from any project directory
cbatchCalleo Applications ONLY alias of bin/batch.php from any project directory
cbatch_xdebugCalleo Applications ONLY alias of bin/batch.php with XDebug active
⁠Readonly environment variables

These variables are used to build the images and can be used to adapt behaviors between their different flavors. Changing their value is not recommended.

Variable nameSample valueDescription
DOCKER_BUILD_DATE2017-12-13T15:22:29+0100Build date of the image, using ISO-8601 format
DOCKER_FROM_COMMITf84a27d7Short hash of the git commit used to build the Docker image in this repository
DOCKER_FROM_IMAGEdebian/stretchName of the base image used to build the Docker image
PHP_VERSION7.1PHP version included in the image
PHP_VERSION_APT7.1PHP version used in the apt-get install instructions
PHP_VERSION_DIR/7.1PHP version used in the paths of PHP configuration files
XHGUI_BASE_DIR/xhguiXHGUI installation directory
⁠Limitations with old PHP versions
  • PHP 5.2:
    • Using DOCKER_COPY_CONFIG_TO_HOST=true will override host local files sharring the same names on each startup of the container.
    • Using DOCKER_WEB_SERVER=nginx is not allowed, and apache will be used instead, this can be overriden by setting the value of DOCKER_WEB_SERVER with a script loaded by DOCKER_CUSTOM_INIT.
  • PHP 5.3:
    • Using DOCKER_WEB_SERVER=nginx is not allowed, and apache will be used instead, this can be overriden by setting the value of DOCKER_WEB_SERVER with a script loaded by DOCKER_CUSTOM_INIT.
  • PHP < 5.5:
    • Using XHGUI_ACTIVE=true is incompatible, on Docker start the variable will be overriden to XHGUI_ACTIVE=false.

Tag summary

Content type

Image

Digest

Size

306.6 MB

Last updated

over 4 years ago

docker pull virtuasa/php:8.1-v2