Skip to content

wayofdev/docker-php-dev

Repository files navigation




Build Status Latest Version Docker Pulls Software License Commits since latest release

Docker Image: PHP Dev(el)

Repository contains dist folder with generated, local development ready, PHP images and source code located in src folder. Written using Ansible, to generate them. It is used, together with other WOD images, to create a local development environment for our projects.

Upstream images:

Additionaly to upstream images, enabled extensions by default:

Extension Description Type
xdebug Debugging extension pecl

Included system tools for easier local development:

Package Type
git apk
bash apk
unzip apk
nano apk
composer bin
faketime apk
wait4x apk

If you like/use this repository, please consider starring it. Thanks!


🔧 Configuration

Ansible is used to generate distribution files, to add or remove PHP extensions, or configure project, see group_vars/prod.yml

Default extension configuration:

ext_pecl_enabled:
  - xdebug

install_composer: true
install_faketime: true

install_postgres_client: false
install_postgres_postgis: false
install_mysql_client: false

system_packages:
  - git
  - bash
  - unzip
  - nano

To generate dist files use ansible command:

$ make generate

⚙️ Development

To install dependencies and start development you can check contents of our Makefile

→ Requirements

For testing purposes we use goss and dgoss, follow installation instructions on their official README


→ Building locally

Generating distributable Dockerfiles from yaml source code:

$ make generate

Building default image:

$ git clone [email protected]:wayofdev/docker-php-dev.git
$ cd docker-php-dev
$ make build

To build image, test it and then clean temporary files run:

$ make

Building all images:

$ make build IMAGE_TEMPLATE="8.1-cli-alpine"
$ make build IMAGE_TEMPLATE="8.1-fpm-alpine"
$ make build IMAGE_TEMPLATE="8.1-supervisord-alpine"
$ make build IMAGE_TEMPLATE="8.2-cli-alpine"
$ make build IMAGE_TEMPLATE="8.2-fpm-alpine"
$ make build IMAGE_TEMPLATE="8.2-supervisord-alpine"
$ make build IMAGE_TEMPLATE="8.3-cli-alpine"
$ make build IMAGE_TEMPLATE="8.3-fpm-alpine"
$ make build IMAGE_TEMPLATE="8.3-supervisord-alpine"

🧪 Testing

You can check Makefile to get full list of commands for local testing. For testing, you can use these commands to test whole role or separate tasks:

Testing default image:

$ make test

To test all images:

$ make test IMAGE_TEMPLATE="8.1-cli-alpine"
$ make test IMAGE_TEMPLATE="8.1-fpm-alpine"
$ make test IMAGE_TEMPLATE="8.1-supervisord-alpine"
$ make test IMAGE_TEMPLATE="8.2-cli-alpine"
$ make test IMAGE_TEMPLATE="8.2-fpm-alpine"
$ make test IMAGE_TEMPLATE="8.2-supervisord-alpine"
$ make test IMAGE_TEMPLATE="8.3-cli-alpine"
$ make test IMAGE_TEMPLATE="8.3-fpm-alpine"
$ make test IMAGE_TEMPLATE="8.3-supervisord-alpine"

→ Code quality tools

Run yamllint to validate all yaml files in project:

$ make lint-yaml

Run hadolint to validate created Dockerfiles:

$ make lint-docker

Run ansible-lint to validate project files:

$ make lint-ansible

Run dive command to analyze image:

$ make analyze

🤝 License

Licence


🙆🏼‍♂️ Author Information

This repository was created in 2022 by lotyp / wayofdev.


🫡 Contributors