Sign inSign up

virtuasa/php-dev

By virtuasa

•Updated 8 days ago

Docker PHP 5.3-8.3 and NodeJS 18/20/22 images dedicated to development

Image
Developer tools
Web servers
0

100K+

virtuasa/php-dev repository overview

Build Status

⁠Docker Image - PHP DEV

The images are built and published on Docker Hub⁠.

All images are also available on Smile Registry⁠ You can replace "virtuasa/" by "registry.smile.fr/smile-suisse/" to use Smile registry

⁠Build

Use make help to see the build targets.

Examples:

  • make all build all images
  • make all-php build all php images
  • make base php-8.3 php-8.3-node-18 build php 8.1 images

⁠Images content

Tags (virtuasa/php-dev:)⁠5.67.07.17.27.37.48.08.18.28.38.4
PHP⁠✔✔✔✔✔✔✔✔✔✔✔
XDebug)⁠✔✔✔✔✔✔✔✔✔✔✔
composer⁠✔✔✔✔✔✔✔✔✔✔✔
local-php-security-checker⁠✔✔✔✔✔✔✔✔✔✔✔
phive⁠✔✔✔✔✔✔✔
Apache⁠apacheapacheapacheapacheapacheapacheapacheapacheapacheapacheapache
NGINX⁠nginxnginxnginxnginxnginxnginxnginxnginxnginxnginxnginx
MSMTP⁠✔✔✔✔✔✔✔✔✔✔✔
NodeJs (node npm)⁠nodenodenodenodenodenodenodenodenodenodenode
Yarn (yarn)⁠nodenodenodenodenodenodenodenodenodenodenode
Debian⁠bookwormbookwormbookwormbookwormbookwormbookwormbookwormbookwormbookwormbookwormbookworm

To customize this 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.

⁠Base image variables
Variable nameDefault valueDescription
HOSTNAME_LOCAL_ALIAS``List of hosts names alias for machine resolved to 127.0.0.1, separator is coma
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
LANGC.UTF-8System locale
SMTP_MAILHUBsmtp.docker:25The host to send mail to, in the form host IP_addr[:port]. The default port is 25.
SMTP_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
SMTP_AUTH_PASS (empty)The password to use for SMTP AUTH.
SMTP_SENDER_HOSTNAME (empty)The full qualified name of the host. If not specified, the host is queried for its hostname.
DOCKER_CUSTOM_INIT (empty)Execute script before doing anything else only on container creation *
DOCKER_COPY_DIR_TO_ETC (empty)Copy directory content to /etc and all process files *.j2 with Jinja2 (all env variables are available) and extension .j2 removed *
DOCKER_COPY_DIR_TO_BIN (empty)Copy directory content to /user/local/bin *
DOCKER_MKDIR (empty)Create requested directories using mkdir -p if set *
⁠PHP image variables
Variable nameDefault valueDescription
WRITABLE_PATHvarThe list of folder writable by apache or nginx (folder separated by space)
VAR_DIRvarDirectory to store applications (php, xdebug, apache, php-fpm, nginx) logs
XDEBUG_MAIN_HOSTlocalhostXDEBUG main host to debug on cli
XDEBUG_DISABLE (empty) or yesXDEBUG disabled on image start, XDEBUG_DISABLE=yes
XDEBUG_CLIENT_HOST (empty)XDEBUG client host to debug on cli recommended value host.docker.internal
MOUNT_DIR/dataDocker mount path inside the container **
PHP_MEMORY_LIMIT512MMaximum amount of memory a PHP script running may consume
ACL_ENABLE (empty) or yesExecute setfacl on container start
⁠PHP apache variables
Variable nameDefault valueDescription
DOCUMENT_ROOTpublicPath to the Apache document root folder if empty direct project root *
SERVER_NAMES`` (empty) or domain1.docker,domain2.dockerFirst domain used as ServerName and the others as ServerAlias, if empty catch all
SSL_CERT_KEY/etc/ssl/private/ssl-cert-snakeoil.keyPrivate key used by Apache for SSL **
SSL_CERT_PEM/etc/ssl/certs/ssl-cert-snakeoil.pemPublic certificate used by Apache for SSL **
SSL_CERT_CA``Optional Server Certificate Chain, PEM encoded CA certificates, used by Apache for SSL **
SSL_FORCE`` (empty) or yesForce http redirect to https
⁠PHP nginx variables
Variable nameDefault valueDescription
DOCUMENT_ROOTpublicPath to the Apache document root folder if empty direct project root *
SERVER_NAMES`` (empty) or domain1.docker,domain2.dockerDomains used as server_name, if empty catch all
SSL_CERT_KEY/etc/ssl/private/ssl-cert-snakeoil.keyPrivate key used by NGNIX for SSL **
SSL_CERT_PEM/etc/ssl/certs/ssl-cert-snakeoil.pemPublic certificate and Certificate Chain used by NGNIX for SSL **
SSL_FORCE`` (empty) or yesForce http redirect to https

* 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 /data of the mount path if needed.

*** FIXUID and FIXGID must be set globally 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 :

⁠PHP images
CommandDescription
xdebug-disableXDebug Disable completely on the container, for performance purpose (http and cli)
xdebug-disable-autostartXDebug Disable auto start on each HTTP call
xdebug-enableXDebug Enable completely on the container, for debug purpose (http and cli)
xdebug-enable-autostartXDebug Enable auto start on each HTTP call
php-xdebug <php script and params>Run a PHP CLI command with XDebug active
php-no-xdebug <php script and params>Run a PHP CLI command without extension XDebug
php-profile <php script and params>Run a PHP CLI command with profiling, profiling file generated
docker-php-ext-disable ext-name [ext-name ...]Disable PHP extension
docker-php-ext-enable ext-name [ext-name ...]Enable PHP extension
docker-php-ext-install ext-name [ext-name ...]Install PHP extension
local-php-security-checkerLocal PHP Security Checker⁠
composerComposer Dependency Manager for PHP⁠
⁠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
PHP_VERSION8.3PHP version included in the image
NODE_VERSION22NODE version included in the image

⁠Example of docker compose.yml

version: '3.9'

services:
  web:
    image: virtuasa/php-dev:8.3-nginx-node-22-bookworm-sury
    user: ${FIXUID:-1000}:${FIXGID:-1000}
    volumes:
      - .:/data
    links:
      - db
      - redis
    environment:
      - HISTFILE=/data/var/.docker_bash_history
      - HISTFILESIZE=1000
      - DOCUMENT_ROOT=public
      - SSL_CERT_PEM=/data/setup/ssl/app.crt
      - SSL_CERT_KEY=/data/setup/ssl/app.key
      - SSL_FORCE=yes
      - SERVER_NAMES=app.amce.docker
      - XDEBUG_MAIN_HOST=app.amce.docker
      - XDEBUG_CLIENT_HOST=host.docker.internal
    extra_hosts:
      - 'host.docker.internal:host-gateway'
    labels:
      - "com.dnsdock.alias=app.amce.docker"

Tag summary

Content type

Image

Digest

sha256:f1c237aa9…

Size

400.2 MB

Last updated

8 days ago

docker pull virtuasa/php-dev:5.6-nginx-node-18-bookworm-sury