|
| 1 | +name: Publish latest PHP images |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_run: |
| 5 | + workflows: ["Test latest PHP images"] |
| 6 | + branches: [main] |
| 7 | + types: [completed] |
| 8 | + |
| 9 | +jobs: |
| 10 | + publish-8: |
| 11 | + name: Build and publish PHP 8 images |
| 12 | + runs-on: ubuntu-22.04 |
| 13 | + if: ${{ github.event.workflow_run.conclusion == 'success' && !contains(github.event.commits[0].message, '[skip ci]') && !contains(github.event.commits[0].message, '[ci skip]') }} |
| 14 | + strategy: |
| 15 | + matrix: |
| 16 | + version: [ 'latest', 'alpine' ] |
| 17 | + steps: |
| 18 | + - name: Checkout |
| 19 | + uses: actions/checkout@v4 |
| 20 | + |
| 21 | + - name: Set up QEMU |
| 22 | + run: | |
| 23 | + docker run --rm --privileged multiarch/qemu-user-static --reset -p yes |
| 24 | +
|
| 25 | + - name: Set up Docker Buildx |
| 26 | + uses: docker/setup-buildx-action@v3 |
| 27 | + with: |
| 28 | + driver-opts: network=host |
| 29 | + |
| 30 | + - name: Login to DockerHub (pull) |
| 31 | + uses: docker/login-action@v3 |
| 32 | + with: |
| 33 | + username: ${{ secrets.DOCKER_PULL_USER_5 }} |
| 34 | + password: ${{ secrets.DOCKER_PULL_PASS_5 }} |
| 35 | + |
| 36 | + - name: Pull base image |
| 37 | + run: docker pull chialab/php:${{ matrix.version }} |
| 38 | + |
| 39 | + - name: Login to DockerHub (push) |
| 40 | + uses: docker/login-action@v3 |
| 41 | + with: |
| 42 | + username: ${{ secrets.DOCKER_USERNAME }} |
| 43 | + password: ${{ secrets.DOCKER_PASSWORD }} |
| 44 | + |
| 45 | + - name: Login to GitHub Container Registry |
| 46 | + uses: docker/login-action@v3 |
| 47 | + with: |
| 48 | + registry: ghcr.io |
| 49 | + username: ${{ github.repository_owner }} |
| 50 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 51 | + |
| 52 | + - name: Build image and push to registry |
| 53 | + uses: docker/build-push-action@v5 |
| 54 | + with: |
| 55 | + platforms: linux/amd64,linux/arm64 |
| 56 | + cache-from: type=registry,ref=ghcr.io/chialab/php:${{ matrix.version }} |
| 57 | + cache-to: type=inline |
| 58 | + context: . |
| 59 | + file: ${{ ((contains(matrix.flavor, 'alpine') || matrix.version == 'alpine') && 'Dockerfile.alpine') || 'Dockerfile' }} |
| 60 | + build-args: | |
| 61 | + BASE_IMAGE=chialab/php:${{ matrix.version }} |
| 62 | + tags: | |
| 63 | + chialab/php:${{ matrix.version }} |
| 64 | + ghcr.io/chialab/php:${{ matrix.version }} |
| 65 | + push: true |
| 66 | + |
| 67 | + - name: Build dev image and push to registry |
| 68 | + uses: docker/build-push-action@v5 |
| 69 | + with: |
| 70 | + platforms: linux/amd64,linux/arm64 |
| 71 | + cache-to: type=inline |
| 72 | + context: ./dev |
| 73 | + build-args: | |
| 74 | + BASE_IMAGE=ghcr.io/chialab/php:${{ matrix.version }} |
| 75 | + tags: | |
| 76 | + chialab/php-dev:${{ matrix.version }} |
| 77 | + ghcr.io/chialab/php-dev:${{ matrix.version }} |
| 78 | + push: true |
| 79 | + |
| 80 | + - name: Build PCOV image and push to registry |
| 81 | + uses: docker/build-push-action@v5 |
| 82 | + with: |
| 83 | + platforms: linux/amd64,linux/arm64 |
| 84 | + cache-to: type=inline |
| 85 | + context: ./pcov |
| 86 | + build-args: | |
| 87 | + BASE_IMAGE=ghcr.io/chialab/php:${{ matrix.version }} |
| 88 | + tags: | |
| 89 | + chialab/php-pcov:${{ matrix.version }} |
| 90 | + ghcr.io/chialab/php-pcov:${{ matrix.version }} |
| 91 | + push: true |
| 92 | + |
| 93 | + - name: Build xhprof image (amd64 only) and push to registry |
| 94 | + uses: docker/build-push-action@v5 |
| 95 | + with: |
| 96 | + cache-to: type=inline |
| 97 | + context: ./xhprof |
| 98 | + build-args: | |
| 99 | + BASE_IMAGE=ghcr.io/chialab/php:${{ matrix.version }} |
| 100 | + tags: | |
| 101 | + chialab/php-xhprof:${{ matrix.version }} |
| 102 | + ghcr.io/chialab/php-xhprof:${{ matrix.version }} |
| 103 | + push: true |
0 commit comments