Files
docker-php/.github/workflows/publish.7.yml
T

111 lines
3.9 KiB
YAML

name: Publish PHP 7 images
on:
workflow_run:
workflows: ["Test PHP 7 images"]
branches: [main]
types: [completed]
jobs:
publish-7:
name: Build and publish PHP 7 images
runs-on: ubuntu-22.04
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: [ '7.0', '7.1', '7.2', '7.3', '7.4' ]
flavor: [ '', '-apache', '-fpm', '-alpine', '-fpm-alpine' ]
exclude:
- version: '7.0'
flavor: '-alpine'
- version: '7.0'
flavor: '-fpm-alpine'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
run: |
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- 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_2 }}
password: ${{ secrets.DOCKER_PULL_PASS_2 }}
- name: Pull base image
run: docker pull chialab/php:${{ matrix.version }}${{ matrix.flavor }}
- 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 }}${{ matrix.flavor }}
cache-to: type=inline
context: .
file: ${{ ((contains(matrix.flavor, 'alpine') || matrix.version == 'alpine') && 'Dockerfile.alpine') || 'Dockerfile' }}
build-args: |
BASE_IMAGE=chialab/php:${{ matrix.version }}${{ matrix.flavor }}
tags: |
chialab/php:${{ matrix.version }}${{ matrix.flavor }}
ghcr.io/chialab/php:${{ matrix.version }}${{ matrix.flavor }}
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 }}${{ matrix.flavor }}
tags: |
chialab/php-dev:${{ matrix.version }}${{ matrix.flavor }}
ghcr.io/chialab/php-dev:${{ matrix.version }}${{ matrix.flavor }}
push: true
- name: Build PCOV image and push to registry
if: ${{ matrix.version >= 7.1 }}
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 }}${{ matrix.flavor }}
tags: |
chialab/php-pcov:${{ matrix.version }}${{ matrix.flavor }}
ghcr.io/chialab/php-pcov:${{ matrix.version }}${{ matrix.flavor }}
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 }}${{ matrix.flavor }}
tags: |
chialab/php-xhprof:${{ matrix.version }}${{ matrix.flavor }}
ghcr.io/chialab/php-xhprof:${{ matrix.version }}${{ matrix.flavor }}
push: true