name: Publish latest PHP images on: workflow_run: workflows: ["Test latest PHP images"] branches: [main] types: [completed] jobs: publish-8: name: Build and publish PHP 8 images runs-on: ubuntu-latest if: ${{ github.event.workflow_run.conclusion == 'success' && !contains(github.event.commits[0].message, '[skip ci]') && !contains(github.event.commits[0].message, '[ci skip]') }} strategy: matrix: version: [ 'latest', 'alpine' ] steps: - name: Checkout uses: actions/checkout@v4 - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 with: driver-opts: network=host - name: Login to DockerHub (pull) uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_PULL_USER_5 }} password: ${{ secrets.DOCKER_PULL_PASS_5 }} - name: Pull base image run: docker pull chialab/php:${{ matrix.version }} - name: Login to DockerHub (push) uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build image and push to registry uses: docker/build-push-action@v5 with: platforms: linux/amd64,linux/arm64 # cache-from: type=registry,ref=ghcr.io/chialab/php:${{ matrix.version }} cache-to: type=inline context: . file: ${{ ((contains(matrix.flavor, 'alpine') || matrix.version == 'alpine') && 'Dockerfile.alpine') || 'Dockerfile' }} build-args: | BASE_IMAGE=php:${{ matrix.version }} tags: | chialab/php:${{ matrix.version }} ghcr.io/chialab/php:${{ matrix.version }} push: true - name: Build dev image and push to registry uses: docker/build-push-action@v5 with: platforms: linux/amd64,linux/arm64 cache-to: type=inline context: ./dev build-args: | BASE_IMAGE=ghcr.io/chialab/php:${{ matrix.version }} tags: | chialab/php-dev:${{ matrix.version }} ghcr.io/chialab/php-dev:${{ matrix.version }} push: true - name: Build PCOV image and push to registry uses: docker/build-push-action@v5 with: platforms: linux/amd64,linux/arm64 cache-to: type=inline context: ./pcov build-args: | BASE_IMAGE=ghcr.io/chialab/php:${{ matrix.version }} tags: | chialab/php-pcov:${{ matrix.version }} ghcr.io/chialab/php-pcov:${{ matrix.version }} push: true - name: Build xhprof image (amd64 only) and push to registry uses: docker/build-push-action@v5 with: cache-to: type=inline context: ./xhprof build-args: | BASE_IMAGE=ghcr.io/chialab/php:${{ matrix.version }} tags: | chialab/php-xhprof:${{ matrix.version }} ghcr.io/chialab/php-xhprof:${{ matrix.version }} push: true - name: Build OTel image and push to registry uses: docker/build-push-action@v5 with: platforms: linux/amd64,linux/arm64 cache-to: type=inline context: ./otel build-args: | BASE_IMAGE=ghcr.io/chialab/php:${{ matrix.version }} tags: | chialab/php-otel:${{ matrix.version }} ghcr.io/chialab/php-otel:${{ matrix.version }} push: true