Skip to content

myxiaoao/docker-php-tutorial

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 

Repository files navigation

Docker PHP Tutorial


Docker PHP Tutorial - Learning Docker for PHP Developers

In this tutorial I'll take you on "my" journey of learning Docker as a PHP developer. Since I actively use everything explained along the way (and force it upon my team ;)) I can hopefully shed some light onto some more advanced issues like cross-OS-setups and seamless IDE integration.

Two words of caution:

  • I tend to write rather lengthy, in-depth articles, so you should allocate some time to work it all through
  • my main OS is Windows. Although most of the things should be easily transferable into OSX/Linux you might run into some quirks that I didn't encounter.

You can also find an overview of the published articles at the Docker PHP Tutorial site of my homepage.

Setup

Each tutorial is placed in a separate branch and has an accompanying article in my blog I recommend cloning the full repository and check out the corresponding branch for easy reference. Example:

mkdir -p /c/codebase
cd /c/codebase/
git clone https://github.com/paslandau/docker-php-tutorial.git
cd docker-php-tutorial

git checkout part_2_setting-up-phpstorm-with-xdebug-for-local-development-on-docker

Tutorials

Please subscribe to my RSS Feed and/or subscribe via email to be automatically notified when a new part gets published. I'll also probably brag about it on Twitter ;)

Playlist

There a YouTube playlist available containing all videos of the tutorial series.

Published

Planned (already used by us but not put into writing):

Roadmap (wow much want, such little time):

Setting up PHP, PHP-FPM and NGINX for local development on Docker

A primer on Docker. What is Docker? How to install it / transition from Vagrant? How to interact with containers? How to organize multiple services (php-cli, php-fpm, nginx) via docker-compose?

Setting up PhpStorm with Xdebug for local development on Docker

Using docker for Development. How to configure PhpStorm to play nicely with Docker? How to setup Xdebug (including the solution for the dreaded 'Connection with Xdebug was not established.' error)?

Structuring the Docker setup for PHP Projects

Running a battle-tested development infrastructure for PHP developers in Docker. How to organize the docker folder structure (e.g. shared scripts for containers)? How to establish a convenient workflow via make?

Docker from scratch for PHP 8.1 Applications in 2022

An update of the previous article (Part 3) with the learnings of the past 3 years:

  • simplify the setup
  • add more containers (redis, mysql, workers)
  • prepare for additional environments (CI, production)

PhpStorm, Docker and Xdebug 3 on PHP 8.1 in 2022

An update of the previous article on setting up PhpStorm (Part 2) using the latest PHP version (PHP 8.1) as well as the latest Xdebug version (3). The article also covers additional debugging challenges (from the browser, from the CLI, from a long-running worker process).

Run Laravel 9 on Docker in 2022

A step-by-step walk through to set up a new Laravel 9 project on the docker setup of this tutorial, using a couple of common Laravel components (Commands, Controllers, Queues, Databases).

Set up PHP QA tools and control them via make

Set up some PHP QA tools like phpcs, phpstan, etc. in the dockerized PHP application and provide make targets to run them either in parallel or individually.

Use git secret to encrypt secrets in the repository

Set up git secret to encrypt and store secrets directly in a git repository. All required tools are set up in Docker and their usage is defined via make targets.

Create a CI pipeline for dockerized PHP Apps

Create a CI pipeline using the dockerized setup introduced in the previous tutorial that can be executed on any CI provider. Concrete examples for Gitlab Pipelines and Github actions are included.

A primer on GCP Compute Instance VMs for dockerized Apps

Getting started with the Google Cloud Platform (GCP) as infrastructure provider for a container registry to push and pull docker images as well as for virtual machines to run dockerized applications.

Deploy dockerized PHP Apps to production on GCP via docker compose

Introduce a prod environment to build docker images that are then deployed "to production" on a GCP VM to be executed via docker compose as a proof-of-concept.

Run dockerized PHP Apps on multiple GCP VMs in production

  • Status: draft
  • Link:
  • Branch:

Scaling Dockerized PHP Applications with Terraform and Kubernetes on GCP/AWS

  • Status: Dream Caused by the Flight of a Bee Around a Pomegranate a Second Before Awakening
  • Link:
  • Branch:

About

Example files of my tutorial on PHP on Docker (check out the branches!)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published