Merge pull request #309 from reload/dependabot/docker/composer-6d2b538 #756
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: Docker build | |
on: push | |
permissions: | |
contents: read | |
jobs: | |
php-versions: | |
name: Lookup PHP versions | |
runs-on: ubuntu-22.04 | |
outputs: | |
matrix: ${{ env.php_versions }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Lookup PHP versions | |
run: echo "php_versions=$(make _versions)" >> "$GITHUB_ENV" | |
build: | |
name: PHP | |
runs-on: ubuntu-22.04 | |
needs: php-versions | |
strategy: | |
fail-fast: false | |
matrix: | |
php: ${{ fromJSON(needs.php-versions.outputs.matrix) }} | |
platform: [linux/arm64, linux/amd64] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@master | |
- name: Build PHP ${{ matrix.php }} (${{ matrix.platform }}) | |
uses: docker/build-push-action@v6 | |
with: | |
file: "Dockerfile" | |
builder: ${{ steps.buildx.outputs.name }} | |
context: . | |
platforms: ${{ matrix.platform }} | |
build-args: "php=${{ matrix.php }}" | |
labels: | | |
org.opencontainers.image.title=PHP ${{ matrix.php }} | |
org.opencontainers.image.description=Docker image for PHP ${{ matrix.php }} FPM | |
org.opencontainers.image.source=https://github.com/${{ github.repository }} | |
org.opencontainers.image.version=${{ matrix.php }}-${{ github.sha }} | |
org.opencontainers.image.revision=${{ github.sha }} | |
tags: | | |
ghcr.io/${{ github.repository }}:${{ matrix.php }} | |
load: ${{ (matrix.platform == 'linux/amd64') }} | |
- uses: e1himself/goss-installation-action@v1.2.1 | |
if: ${{ (matrix.platform == 'linux/amd64') }} | |
- name: Test PHP ${{ matrix.php }} | |
if: ${{ (matrix.platform == 'linux/amd64') }} | |
run: | | |
# Sleep a bit to ensure that PHP-FPM has time to start up. | |
GOSS_SLEEP=15 dgoss run -e GOSS_VARS_INLINE='php_version: "${{ matrix.php }}"' ghcr.io/${{ github.repository }}:${{ matrix.php }} |