As a part of my new year resolution, I want to replace the Vagrant-based local development environment that I’ve been using for the past few years with Docker. While there’s nothing wrong with it, I started to hit some limitations with it for the past years.
I have one specific VM provisioned in Vagrant for all work-related projects. Although it’s not ideal to house multiple projects in it, the setup is flexible enough for me to use different PHP versions across multiple projects. Since the databases are hosted inside the same VM, the disk space required grows as well. Docker is supposed to be the better alternative since you can decide the stack independently to build up your project dependencies.
As a result, I’ve created this basic LEMP-stack in Docker. By configuring the stack using the .env
file, I can mix and match Nginx, PHP, and MySQL versions required for a specific project easily. It also includes Mailhog for email debugging, a basic scheduler based on mcuadros/ofelia excellent Go-based job scheduler, a Node.js service for assets compilation, and some extra configuration to run Laravel locally.
Credit goes to osteel’s blog for an awesome introduction series for Docker which nudge me in the right direction.