Skip to content

Build image and push to Docker Hub #869

Build image and push to Docker Hub

Build image and push to Docker Hub #869

Workflow file for this run

name: Build image and push to Docker Hub
on:
push:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
max-parallel: 1
matrix:
version: ['base', 'mssql', 'xdebug', 'mssql-xdebug']
steps:
-
name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.ref_name }}
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Create tag name
id: build-tag
run: |
if [[ ${{ matrix.version }} == 'base' ]]; then
echo "::set-output name=tag::"
else
echo "::set-output name=tag::-${{ matrix.version }}"
fi
-
name: Build latest
if: ${{ github.ref_name == '8.3' && matrix.version == 'base' }}
uses: docker/build-push-action@v6
with:
context: ./base
push: true
platforms: ${{ secrets.DOCKER_PLATFORMS }}
tags: rshop/php:latest
-
name: Build ${{ matrix.version }}
uses: docker/build-push-action@v6
with:
context: ./${{ matrix.version }}
push: true
platforms: ${{ secrets.DOCKER_PLATFORMS }}
tags: rshop/php:${{ github.ref_name }}${{ steps.build-tag.outputs.tag }}
-
name: Trigger apache ${{ matrix.version }} rebuild
uses: rshop/trigger-workflow-action@v1
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
repository: 'rshop/docker-php-apache'
branch: ${{ github.ref_name }}${{ steps.build-tag.outputs.tag }}
-
name: Trigger swoole ${{ matrix.version }} rebuild
if: ${{ !contains(matrix.version, 'xdebug') }}
uses: rshop/trigger-workflow-action@v1
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
repository: 'rshop/docker-swoole'
branch: ${{ github.ref_name }}${{ steps.build-tag.outputs.tag }}