Update docker files for PHP 8.4 #12
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and test Docker images | |
| on: | |
| pull_request: | |
| branches: | |
| - master | |
| paths-ignore: | |
| - "*.md" | |
| - 'LICENSE' | |
| - 'docs/' | |
| - '.gitignore' | |
| - 'docker-compose.yml' | |
| - 'Makefile' | |
| env: | |
| IMAGE_PREFIX: localhost:5000/brettt89/silverstripe-web | |
| REGISTRY_PATH: ${{ github.workspace }}/registry | |
| CACHE_PATH: /tmp/.buildx-cache | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [trixie, bookworm, bullseye, alpine] | |
| php: ['8.1', '8.2', '8.3', '8.4'] | |
| distro: [apache, fpm, cli] | |
| exclude: | |
| - os: alpine | |
| distro: apache | |
| - os: trixie | |
| php: '8.1' | |
| - os: trixie | |
| php: '8.2' | |
| - os: trixie | |
| php: '8.3' | |
| - os: bullseye | |
| php: '8.4' | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v2 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| with: | |
| driver-opts: network=host | |
| - name: Start Docker registry | |
| run: | | |
| docker run --rm --detach --publish 5000:5000 \ | |
| --volume ${REGISTRY_PATH}:/var/lib/registry \ | |
| --name registry registry:2 | |
| - name: Build silverstripe docker image (attempt 1) | |
| id: build_attempt_1 | |
| continue-on-error: true | |
| uses: docker/build-push-action@v3.2.0 | |
| with: | |
| context: src/${{ matrix.php }}/${{ matrix.distro }}/${{ matrix.os }} | |
| platforms: linux/amd64,linux/arm64 | |
| cache-from: type=gha,scope=${{ matrix.php }}-${{ matrix.distro }}-${{ matrix.os }} | |
| cache-to: type=gha,scope=${{ matrix.php }}-${{ matrix.distro }}-${{ matrix.os }} | |
| push: true | |
| tags: ${{ env.IMAGE_PREFIX }}:${{ matrix.php }}-${{ matrix.distro }}-${{ matrix.os }}-test | |
| - name: Build silverstripe docker image (attempt 2) | |
| id: build_attempt_2 | |
| if: steps.build_attempt_1.outcome == 'failure' | |
| continue-on-error: true | |
| uses: docker/build-push-action@v3.2.0 | |
| with: | |
| context: src/${{ matrix.php }}/${{ matrix.distro }}/${{ matrix.os }} | |
| platforms: linux/amd64,linux/arm64 | |
| cache-from: type=gha,scope=${{ matrix.php }}-${{ matrix.distro }}-${{ matrix.os }} | |
| cache-to: type=gha,scope=${{ matrix.php }}-${{ matrix.distro }}-${{ matrix.os }} | |
| push: true | |
| tags: ${{ env.IMAGE_PREFIX }}:${{ matrix.php }}-${{ matrix.distro }}-${{ matrix.os }}-test | |
| - name: Build silverstripe docker image (attempt 3) | |
| if: steps.build_attempt_2.outcome == 'failure' | |
| uses: docker/build-push-action@v3.2.0 | |
| with: | |
| context: src/${{ matrix.php }}/${{ matrix.distro }}/${{ matrix.os }} | |
| platforms: linux/amd64,linux/arm64 | |
| cache-from: type=gha,scope=${{ matrix.php }}-${{ matrix.distro }}-${{ matrix.os }} | |
| cache-to: type=gha,scope=${{ matrix.php }}-${{ matrix.distro }}-${{ matrix.os }} | |
| push: true | |
| tags: ${{ env.IMAGE_PREFIX }}:${{ matrix.php }}-${{ matrix.distro }}-${{ matrix.os }}-test | |
| - name: Stop Docker registry | |
| run: docker stop registry | |
| - name: Upload Docker registry data for testing | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: docker-registry-data-${{ matrix.php }}-${{ matrix.distro }}-${{ matrix.os }} | |
| path: ${{ env.REGISTRY_PATH }}/ | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| needs: build | |
| strategy: | |
| matrix: | |
| platform: [linux/amd64, linux/arm64] | |
| os: [trixie, bookworm, bullseye, alpine] | |
| php: ['8.1', '8.2', '8.3', '8.4'] | |
| distro: [apache, fpm, cli] | |
| exclude: | |
| - os: alpine | |
| distro: apache | |
| - os: trixie | |
| php: '8.1' | |
| - os: trixie | |
| php: '8.2' | |
| - os: trixie | |
| php: '8.3' | |
| - os: bullseye | |
| php: '8.4' | |
| env: | |
| PLATFORM: ${{ matrix.platform }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Download Docker registry data from build job | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: docker-registry-data-${{ matrix.php }}-${{ matrix.distro }}-${{ matrix.os }} | |
| path: ${{ env.REGISTRY_PATH }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v2 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| - name: Start Docker registry | |
| run: | | |
| docker run --rm --detach --publish 5000:5000 \ | |
| --volume ${REGISTRY_PATH}:/var/lib/registry \ | |
| --name registry registry:2 | |
| sleep 10 | |
| - name: Import Docker images | |
| run: docker pull --platform ${{ matrix.platform }} ${{ env.IMAGE_PREFIX }}:${{ matrix.php }}-${{ matrix.distro }}-${{ matrix.os }}-test | |
| - name: Docker inspect | |
| run: docker buildx imagetools inspect ${{ env.IMAGE_PREFIX }}:${{ matrix.php }}-${{ matrix.distro }}-${{ matrix.os }}-test | grep '${{ matrix.platform }}' | |
| - id: test | |
| uses: ./.github/actions/build-test | |
| with: | |
| image: ${{ env.IMAGE_PREFIX }}:${{ matrix.php }}-${{ matrix.distro }}-${{ matrix.os }}-test | |
| platform: ${{ matrix.platform }} | |
| php: ${{ matrix.php }} | |
| distro: ${{ matrix.distro }} | |
| os: ${{ matrix.os }} | |
| - name: Cleanup | |
| run: | | |
| docker stop registry |