Symbiote

Engineer the web, together.

Docker-based SilverStripe Projects

We're moving a lot of our projects these days over to using docker for defining the development environment, where each project has its own docker-compose.yml definition file to provide an identical development environment for all devs on the project.

Take a look at the project over on Github - this contains the docker-compose file (and related helper scripts) along with the underlying docker image definitions. Our definition defines the following core services.

  • apache
  • php-fpm
  • php-cli
  • mysql
  • node

Along with, specifically for development -

  • selenium
  • mailhog
  • adminer

And then optional images for third party services

A visualisation of this is below

docker-compose services for Symbiote's base PHP docker projects

Along with the docker-compose file, the project provides two helper scripts

  • du.sh - a docker-compose up wrapper that allows the listing of just the needed services for the project, which sets some default environment variables if not already set elsewhere
  • dr.sh - a wrapper around docker exec for performing actions on containers, so that running commands such as composer are straight forward; ./dr.sh composer update my/module

Most importantly, docker-compose is defined in such a way as to be directly usable on Gitlab CI. That configuration is for another post...