Docker Image #1
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 Image | |
| env: | |
| IMAGE: ghcr.io/yiisoft-contrib/php-dev | |
| on: | |
| workflow_dispatch: ~ | |
| workflow_run: | |
| workflows: [ "Checks" ] | |
| branches: [ "master" ] | |
| types: | |
| - completed | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| build: | |
| if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
| runs-on: ubuntu-latest | |
| concurrency: | |
| group: docker-image-build-${{ matrix.php }} | |
| cancel-in-progress: true | |
| strategy: | |
| matrix: | |
| php: ['8.1', '8.2', '8.3', '8.4', '8.5'] | |
| steps: | |
| - name: Get current timestamp | |
| id: timestamp | |
| run: echo "rfc3339=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Login to GitHub container registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: https://ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Docker QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Setup Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build & push image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: docker | |
| build-args: PHP_VERSION=${{ matrix.php }} | |
| platforms: linux/amd64,linux/arm64 | |
| tags: ${{ env.IMAGE }}:${{ matrix.php }} | |
| push: ${{ github.ref == 'refs/heads/master' }} | |
| labels: | | |
| org.opencontainers.image.source=${{ github.event.repository.html_url }} | |
| org.opencontainers.image.created=${{ steps.timestamp.outputs.rfc3339 }} | |
| org.opencontainers.image.revision=${{ github.sha }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |