Pipeline A: The "Factory" (image-builder-pipeline.yml)
The pipeline that builds, compresses, and publishes your Docker image artifact — runs only when the Dockerfile changes.
Runs only when the Dockerfile changes.
# image-builder-pipeline.yml
trigger:
paths: { include: ['ci/docker/Dockerfile'] }
stages:
- stage: BuildImage
jobs:
- job: Build
steps:
- script: docker build --pull -t php-build-[PROJECT] -f ci/docker/Dockerfile .
- script: docker save php-build-[PROJECT] | gzip -c > artifact/php-build-[PROJECT].tar.gz
- task: PublishBuildArtifacts@1
FROM php:8.3-cli
RUN apt-get update && apt-get install -y curl git libzip-dev default-mysql-client \
&& docker-php-ext-install zip gd pdo_mysql
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
WORKDIR /app