Skip to content

Build Docker image

Build Docker image #43

Workflow file for this run

name: Build Docker image
on:
workflow_dispatch:
schedule:
- cron: '5 4 1,15 * *'
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
DOCKERFILE_DIR: php8
jobs:
buildx:
runs-on: ubuntu-latest
strategy:
matrix:
php_version: ['8.0', '8.1', '8.2']
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker buildx
id: buildx
uses: docker/setup-buildx-action@v3
-
name: Inspect builder
run: |
echo "Name: ${{ steps.buildx.outputs.name }}"
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}"
echo "Status: ${{ steps.buildx.outputs.status }}"
echo "Flags: ${{ steps.buildx.outputs.flags }}"
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: hussainweb
password: ${{ secrets.DOCKERHUB_TOKEN }}
if: github.event_name != 'pull_request'
-
name: Set Dockerfile directory
if: ${{ matrix.php_version == '8.0' || matrix.php_version == '8.1' || matrix.php_version == '8.2' }}
run: echo "DOCKERFILE_DIR=php8" >> $GITHUB_ENV
-
name: Build and push Docker image for PHP ${{ matrix.php_version }}
uses: docker/build-push-action@v5
with:
context: ${{ env.DOCKERFILE_DIR }}/apache/
push: ${{ github.event_name != 'pull_request' }}
tags: hussainweb/drupal-base:php${{ matrix.php_version }}${{ matrix.php_version == '8.2' && ',hussainweb/drupal-base:latest' || '' }}
build-args: |
PHP_VERSION=${{ matrix.php_version }}-apache-bullseye
platforms: linux/amd64,linux/arm64