Files

97 lines
3.3 KiB
YAML

name: Publish PHP 5 images
on:
workflow_run:
workflows: ["Test PHP 5 images"]
branches: [main]
types: [completed]
jobs:
publish-5:
name: Build and publish PHP 5 images
runs-on: ubuntu-22.04
if: ${{ github.event_name != 'pull_request' && !contains(github.event.commits[0].message, '[skip ci]') && !contains(github.event.commits[0].message, '[ci skip]') }}
strategy:
matrix:
version: [ '5.6' ]
flavor: [ '', '-apache', '-fpm', '-alpine', '-fpm-alpine' ]
exclude:
- version: '5.6'
flavor: '-alpine'
- version: '5.6'
flavor: '-fpm-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_1 }}
password: ${{ secrets.DOCKER_PULL_PASS_1 }}
- 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=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
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 xhprof image and push to registry
uses: docker/build-push-action@v5
with:
platforms: linux/amd64
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