diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 03a3ec94..d878d475 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -14,8 +14,8 @@ jobs: build_test_maybe_release: strategy: matrix: - variant: ['cli','apache','fpm'] php_version: ['8.1','8.0','7.4', '7.3','7.2'] + variant: ['apache','cli','fpm'] runs-on: ubuntu-latest steps: - name: Set up QEMU @@ -29,8 +29,18 @@ jobs: PHP_VERSION="${{ matrix.php_version }}" docker buildx bake --load \ --set "*.platform=linux/amd64" \ - php${PHP_VERSION//.}-${{ matrix.variant }} - docker images --filter=reference=thecodingmachine/php + php${PHP_VERSION//.}-slim-${{ matrix.variant }} + docker buildx bake --load \ + --set "*.platform=linux/amd64" \ + php${PHP_VERSION//.}-${{ matrix.variant }}-all + PHP_VERSION_MINOR=`docker run --rm thecodingmachine/php:${PHP_VERSION}-v4-slim-cli php -v | head -n1 | grep -P '\d+\.\d+\.\d+' -o | head -n1` + echo "PHP_VERSION_MINOR=${PHP_VERSION_MINOR}" >> $GITHUB_ENV + echo "PHP Version : ${PHP_VERSION_MINOR}" >> $GITHUB_STEP_SUMMARY + docker images --filter=reference=thecodingmachine/php >> $GITHUB_STEP_SUMMARY + - name: Test ${{ matrix.variant }} + run: | + PHP_VERSION="${{ matrix.php_version }}" BRANCH=v4 VARIANT=${{ matrix.variant }} ./test-image.sh + echo "${{ matrix.variant }} variant OK" >> $GITHUB_STEP_SUMMARY - name: Login to DockerHub # Merge ~ push. if: ${{ github.event_name == 'push' || github.event_name == 'schedule' }} @@ -42,10 +52,15 @@ jobs: # Merge ~ push. if: ${{ github.event_name == 'push' || github.event_name == 'schedule' }} run: | - PHP_VERSION="${{ matrix.php_version }}" \ - PHP_PATCH_VERSION=`docker run --rm thecodingmachine/php:${PHP_VERSION}-v4-slim-${{ matrix.variant }} php -v | head -n1 | grep -P '\d+\.\d+\.\d+' -o | head -n1` \ - PHP_PATCH_MINOR="${PHP_PATCH_VERSION}" \ + PHP_VERSION="${{ matrix.php_version }}" + PHP_PATCH_MINOR="${{ env.PHP_VERSION_MINOR }}" \ + docker buildx bake \ + --set "*.platform=linux/amd64,linux/arm64" \ + --set "*.output=type=registry" \ + php${PHP_VERSION//.}-slim-${{ matrix.variant }} + PHP_PATCH_MINOR="${{ env.PHP_VERSION_MINOR }}" \ docker buildx bake \ --set "*.platform=linux/amd64,linux/arm64" \ --set "*.output=type=registry" \ - php${PHP_VERSION//.}-${{ matrix.variant }} + php${PHP_VERSION//.}-${{ matrix.variant }}-all + docker images --filter=reference=thecodingmachine/php >> $GITHUB_STEP_SUMMARY diff --git a/docker-bake.hcl b/docker-bake.hcl index 0deadf60..138030f8 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -11,62 +11,129 @@ group "default" { ] } -group "php81" { +group "php81-apache-all" { targets = [ "php81-slim-apache", "php81-apache", - "php81-apache-node16","php81-apache-node14","php81-apache-node12","php81-apache-node10","php81-slim-fpm", + "php81-apache-node16","php81-apache-node14","php81-apache-node12","php81-apache-node10", + ] +} +group "php81-fpm-all" { + targets = [ + "php81-slim-fpm", "php81-fpm", - "php81-fpm-node16","php81-fpm-node14","php81-fpm-node12","php81-fpm-node10","php81-slim-cli", + "php81-fpm-node16","php81-fpm-node14","php81-fpm-node12","php81-fpm-node10", + ] +} +group "php81-cli-all" { + targets = [ + "php81-slim-cli", "php81-cli", "php81-cli-node16","php81-cli-node14","php81-cli-node12","php81-cli-node10", ] } -group "php80" { +group "php80-apache-all" { targets = [ "php80-slim-apache", "php80-apache", - "php80-apache-node16","php80-apache-node14","php80-apache-node12","php80-apache-node10","php80-slim-fpm", + "php80-apache-node16","php80-apache-node14","php80-apache-node12","php80-apache-node10", + ] +} +group "php80-fpm-all" { + targets = [ + "php80-slim-fpm", "php80-fpm", - "php80-fpm-node16","php80-fpm-node14","php80-fpm-node12","php80-fpm-node10","php80-slim-cli", + "php80-fpm-node16","php80-fpm-node14","php80-fpm-node12","php80-fpm-node10", + ] +} +group "php80-cli-all" { + targets = [ + "php80-slim-cli", "php80-cli", "php80-cli-node16","php80-cli-node14","php80-cli-node12","php80-cli-node10", ] } -group "php74" { +group "php74-apache-all" { targets = [ "php74-slim-apache", "php74-apache", - "php74-apache-node16","php74-apache-node14","php74-apache-node12","php74-apache-node10","php74-slim-fpm", + "php74-apache-node16","php74-apache-node14","php74-apache-node12","php74-apache-node10", + ] +} +group "php74-fpm-all" { + targets = [ + "php74-slim-fpm", "php74-fpm", - "php74-fpm-node16","php74-fpm-node14","php74-fpm-node12","php74-fpm-node10","php74-slim-cli", + "php74-fpm-node16","php74-fpm-node14","php74-fpm-node12","php74-fpm-node10", + ] +} +group "php74-cli-all" { + targets = [ + "php74-slim-cli", "php74-cli", "php74-cli-node16","php74-cli-node14","php74-cli-node12","php74-cli-node10", ] } -group "php73" { +group "php73-apache-all" { targets = [ "php73-slim-apache", "php73-apache", - "php73-apache-node16","php73-apache-node14","php73-apache-node12","php73-apache-node10","php73-slim-fpm", + "php73-apache-node16","php73-apache-node14","php73-apache-node12","php73-apache-node10", + ] +} +group "php73-fpm-all" { + targets = [ + "php73-slim-fpm", "php73-fpm", - "php73-fpm-node16","php73-fpm-node14","php73-fpm-node12","php73-fpm-node10","php73-slim-cli", + "php73-fpm-node16","php73-fpm-node14","php73-fpm-node12","php73-fpm-node10", + ] +} +group "php73-cli-all" { + targets = [ + "php73-slim-cli", "php73-cli", "php73-cli-node16","php73-cli-node14","php73-cli-node12","php73-cli-node10", ] } -group "php72" { +group "php72-apache-all" { targets = [ "php72-slim-apache", "php72-apache", - "php72-apache-node16","php72-apache-node14","php72-apache-node12","php72-apache-node10","php72-slim-fpm", + "php72-apache-node16","php72-apache-node14","php72-apache-node12","php72-apache-node10", + ] +} +group "php72-fpm-all" { + targets = [ + "php72-slim-fpm", "php72-fpm", - "php72-fpm-node16","php72-fpm-node14","php72-fpm-node12","php72-fpm-node10","php72-slim-cli", + "php72-fpm-node16","php72-fpm-node14","php72-fpm-node12","php72-fpm-node10", + ] +} +group "php72-cli-all" { + targets = [ + "php72-slim-cli", "php72-cli", "php72-cli-node16","php72-cli-node14","php72-cli-node12","php72-cli-node10", ] } + +group "php81" { + targets = ["php81-apache-all","php81-fpm-all","php81-cli-all",] +} +group "php80" { + targets = ["php80-apache-all","php80-fpm-all","php80-cli-all",] +} +group "php74" { + targets = ["php74-apache-all","php74-fpm-all","php74-cli-all",] +} +group "php73" { + targets = ["php73-apache-all","php73-fpm-all","php73-cli-all",] +} +group "php72" { + targets = ["php72-apache-all","php72-fpm-all","php72-cli-all",] +} + variable "REPO" {default = "thecodingmachine/php"} variable "PHP_PATCH_MINOR" {default = ""} variable "GLOBAL_VERSION" {default = "v4"} diff --git a/utils/docker-bake.blueprint.hcl b/utils/docker-bake.blueprint.hcl index ed7ef268..616bb200 100644 --- a/utils/docker-bake.blueprint.hcl +++ b/utils/docker-bake.blueprint.hcl @@ -5,13 +5,18 @@ group "default" { "php{{ $phpV | replace "." "" }}",{{end}} ] } -{{range $phpV := $versions}} -group "php{{ $phpV | replace "." "" }}" { +{{range $phpV := $versions}}{{range $variant := $variants}} +group "php{{ $phpV | replace "." "" }}-{{ $variant }}-all" { targets = [ - {{range $variant := $variants}}"php{{ $phpV | replace "." "" }}-slim-{{ $variant }}", + "php{{ $phpV | replace "." "" }}-slim-{{ $variant }}", "php{{ $phpV | replace "." "" }}-{{ $variant }}", - {{range $nodeV := $nodeVersions}}"php{{ $phpV | replace "." "" }}-{{ $variant }}-node{{ $nodeV }}",{{end}}{{end}} + {{range $nodeV := $nodeVersions}}"php{{ $phpV | replace "." "" }}-{{ $variant }}-node{{ $nodeV }}",{{end}} ] +}{{end}}{{end}} + +{{range $phpV := $versions}} +group "php{{ $phpV | replace "." "" }}" { + targets = [{{range $variant := $variants}}"php{{ $phpV | replace "." "" }}-{{ $variant }}-all",{{end}}] }{{end}} variable "REPO" {default = "thecodingmachine/php"}