Packaging & Deployment
Prerequisites: Testing strategies
FROM php:8.4-fpm
COPY . /var/www/html
WORKDIR /var/www/html
RUN docker-php-ext-install pdo pdo_mysql opcache
COPY --from=composer /usr/bin/composer /usr/bin/composer
RUN composer install --no-dev --optimize-autoloader
--optimize-autoloader pre-builds Composer's class map instead of
resolving it dynamically on every request — another meaningful,
free production performance win, alongside OPcache. A CI/CD
pipeline typically runs PHPUnit and PHPStan on every push, then
builds and deploys this image on a merge to the main branch.