Core Concept 1: The "Locked Box" (Why We Must Use Docker)

27 October 2025
Previous Post
Next Post

Before we look at any YAML, we must justify using Docker at all. Your Dockerfile is the most important part of this entire setup.

  1. It Guarantees Reliability: The ubuntu-latest agent is a "floating" environment. Microsoft updates it constantly. Your Dockerfile creates a locked, immutable environment that guarantees you have PHP 8.3, the gd and pdo_mysql extensions, composer, and the acli—today, tomorrow, and a year from now. This ends all "it broke on Monday" bugs.
  2. It Ensures Portability: When a build fails, a developer can't debug the aws-ubuntu-latest agent on their laptop. But they can run docker build locally. This eliminates "it works on my machine" and lets developers reproduce and fix CI failures in minutes.
  3. It's Actually Faster: The "no-docker" approach is a trap. You would have to waste time in every single job running apt-get and curl to install acli and your extensions. By pre-baking them into an image, your tools are instantly available.