Skip to content

Repository files navigation

php-dev

PHP-DEV is a small package that includes a web server, PHP and some tools needed to develop a web application. You can easily decide which version of PHP you want to use and whether you want to start an Apache or a Nginx webserver by setting the values in a docker-compose.yml. We recommend using pluswerk/docker-global as a wrapper for your projects, since this Dockerfile has been built keeping that in mind.

Tags

  • php versions supported: 8.1-8.5
  • php versions unsupported: 5.6-8.0
  • webserver supported: nginx and apache
  • alpine images: -alpine
  • examples
    • pluswerk/php-dev:nginx-8.5-alpine
    • pluswerk/php-dev:apache-8.1-alpine
    • pluswerk/php-dev:nginx-8.4
  • list of all Tags

Setup

Create a compose/Development/docker-compose.yml like shown below.
Change all your settings. Mainly the VIRTUAL_HOST, WEB_DOCUMENT_ROOT and optionally the Application Context. The Environment Variable CONTEXT is used to switch between different docker-compose.yml files.

Then you can copy the start.sh into your project and start it.

Documentation

The base Docker Images are webdevops/php-apache-dev and webdevops/php-nginx-dev respectively. (github)

Features

Helpful Information

Docker compose

This is an example of a docker-compose.yml file. It is enough to put this file into the project, configure it and start the Docker Project. Further information can be found in the Documentation.

Example file: compose/Development/docker-compose.yml

services:
web:
image: pluswerk/php-dev:nginx-8.5-alpinevolumes:
- .:/app# the docker socket is optional if no node container is needed
- /var/run/docker.sock:/var/run/docker.sock:ro
- ~/.ssh:/home/application/.ssh
- ~/.composer/cache:/home/application/.composer/cache
- ~/.gitconfig:/home/application/.gitconfigenvironment:
# Take a look at VIRTUAL_* in the documentation under Nginx Reverse ProxyVIRTUAL_HOST: docker-website.${TLD_DOMAIN:?TLD_DOMAIN is required},sub.docker-website.${TLD_DOMAIN:?TLD_DOMAIN is required}# HTTPS_METHOD: noredirectWEB_DOCUMENT_ROOT: /app/publicXDEBUG_CLIENT_HOST: ${XDEBUG_CLIENT_HOST:-}php.xdebug.idekey: ${XDEBUG_IDEKEY:-PHPSTORM}PHP_IDE_CONFIG: ${XDEBUG_IDEKEY:-"serverName=_"}# Project Env vars (enable what you need)# APP_ENV: development_docker# PIMCORE_ENVIRONMENT: development_docker# TYPO3_CONTEXT: Development/docker# Don't forget to connect via bash start.shAPPLICATION_UID: ${APPLICATION_UID:-1000}APPLICATION_GID: ${APPLICATION_GID:-1000}node:
image: node:24volumes:
- ./:/appworking_dir: /appenvironment:
# Don't forget to connect via bash start.shAPPLICATION_UID: ${APPLICATION_UID:-1000}APPLICATION_GID: ${APPLICATION_GID:-1000}stop_signal: SIGKILLentrypoint: bash -c 'groupmod -g $$APPLICATION_GID node; usermod -u $$APPLICATION_UID node; sleep infinity'networks:
default:
name: globalexternal: true

Hint for the example above: In your own configuration you might want to replace docker-website with your project name, e.g typo3. TLD_DOMAIN is an environment variable, your nginx container listens on for incoming requests. e.g. example.com. Your project will then be reachable by going to this domain: typo3.example.com

Tested with

This project is a basic php-installation and should be able to run most applications. Nonetheless has this tool successfully been tested/used with:

  • TYPO3 >=7
  • PIMCore >= 5.4
  • Standalone PHP (Symfony, Laravel/Lumen, Vanilla) Projects
  • WordPress >= 4.5

If you find any bug, don't hesitate to file an issue and/or pull request.

Releases

Packages

Used by

Contributors

Languages