build-all-containers #1148
This file contains 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: build-all-containers | |
on: | |
pull_request: | |
push: | |
branches: [ master ] | |
# Allow workflow to be manually run from the GitHub UI | |
workflow_dispatch: | |
# Daily build | |
schedule: | |
- cron: "0 2 * * *" | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- name: php74 | |
folder: php/7.4 | |
arch: [ linux/amd64, linux/arm64, linux/arm/v7 ] | |
targets: | |
primary: | |
name: cli | |
tags: phpdockerio/php:7.4-cli,phpdockerio/php74-cli:latest | |
secondary: | |
name: fpm | |
tags: phpdockerio/php:7.4-fpm,phpdockerio/php74-fpm:latest | |
tertiary: | |
name: swoole | |
tags: phpdockerio/php74-swoole:latest | |
- name: php80 | |
folder: php/8.0 | |
arch: [ linux/amd64, linux/arm64, linux/arm/v7 ] | |
targets: | |
primary: | |
name: cli | |
tags: phpdockerio/php:8.0-cli,phpdockerio/php80-cli:latest | |
secondary: | |
name: fpm | |
tags: phpdockerio/php:8.0-fpm,phpdockerio/php80-fpm:latest | |
tertiary: | |
name: swoole | |
tags: phpdockerio/php80-swoole:latest | |
- name: php81 | |
folder: php/8.1 | |
arch: [ linux/amd64, linux/arm64, linux/arm/v7 ] | |
targets: | |
primary: | |
name: cli | |
tags: phpdockerio/php:8.1-cli | |
secondary: | |
name: fpm | |
tags: phpdockerio/php:8.1-fpm | |
tertiary: ~ | |
- name: php82 | |
folder: php/8.2 | |
arch: [ linux/amd64, linux/arm64, linux/arm/v7 ] | |
targets: | |
primary: | |
name: cli | |
tags: phpdockerio/php:8.2-cli | |
secondary: | |
name: fpm | |
tags: phpdockerio/php:8.2-fpm | |
tertiary: ~ | |
- name: php83 | |
folder: php/8.3 | |
arch: [ linux/amd64, linux/arm64, linux/arm/v7 ] | |
targets: | |
primary: | |
name: cli | |
tags: phpdockerio/php:8.3-cli | |
secondary: | |
name: fpm | |
tags: phpdockerio/php:8.3-fpm | |
tertiary: ~ | |
- name: php84 | |
folder: php/8.4 | |
arch: [ linux/amd64, linux/arm64, linux/arm/v7 ] | |
targets: | |
primary: | |
name: cli | |
tags: phpdockerio/php:8.4-cli | |
secondary: | |
name: fpm | |
tags: phpdockerio/php:8.4-fpm | |
tertiary: ~ | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Debug | |
run: | | |
echo "is_master: -> ${{ github.ref == 'refs/heads/master' }} <-" | |
echo "ref: ${{ github.head_ref }}" | |
- name: Set up QEMU (required for arm build) | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
if: ${{ github.ref == 'refs/heads/master' }} | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Primary container | |
uses: docker/build-push-action@v6 | |
with: | |
context: ${{ matrix.folder }} | |
platforms: ${{ join(matrix.arch, ',') }} | |
push: ${{ github.ref == 'refs/heads/master' }} | |
pull: true | |
tags: ${{ matrix.targets.primary.tags }} | |
target: ${{ matrix.targets.primary.name }} | |
- name: Secondary container | |
if: matrix.targets.secondary | |
uses: docker/build-push-action@v6 | |
with: | |
context: ${{ matrix.folder }} | |
platforms: ${{ join(matrix.arch, ',') }} | |
push: ${{ github.ref == 'refs/heads/master' }} | |
pull: true | |
tags: ${{ matrix.targets.secondary.tags }} | |
target: ${{ matrix.targets.secondary.name }} | |
- name: Tertiary container | |
if: matrix.targets.tertiary | |
uses: docker/build-push-action@v6 | |
with: | |
context: ${{ matrix.folder }} | |
platforms: ${{ join(matrix.arch, ',') }} | |
push: ${{ github.ref == 'refs/heads/master' }} | |
pull: true | |
tags: ${{ matrix.targets.tertiary.tags }} | |
target: ${{ matrix.targets.tertiary.name }} |