Skip to content

Add build for ARM

Add build for ARM #25

Workflow file for this run

name: Build Docker Images
permissions:
contents: read
packages: write
on:
push:
branches: [ main ]
paths-ignore:
- "README.md"
- "docker-compose.yml"
- "examples/**"
- ".run/**"
- ".circleci/**"
schedule:
- cron: "0 16 * * MON,WED,FRI"
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
php_version: ['8.3', '8.1', '8.0', '7.4']
variant: ['apache', 'apache-chrome']
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Registry
run: echo "${{ secrets.DOCKER_HUB_TOKEN }}" | docker login -u ${{ secrets.DOCKER_HUB_USER }} --password-stdin
- name: Login to GitHub Container Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Github Short SHA
run: |
echo "GITHUB_SHA_SHORT=$(echo $GITHUB_SHA | cut -c 1-7)" >> $GITHUB_ENV
- name: Set variables
run: |
if [ "${{ matrix.variant }}" == "apache" ]; then
echo "DOCKER_TAG=${{ matrix.php_version }}" >> $GITHUB_ENV
echo "DOCKER_FILE=Dockerfile" >> $GITHUB_ENV
elif [ "${{ matrix.variant }}" == "apache-chrome" ]; then
echo "DOCKER_TAG=${{ matrix.php_version }}-headless" >> $GITHUB_ENV
echo "DOCKER_FILE=Dockerfile-headless" >> $GITHUB_ENV
else
echo "Invalid variant: ${{ matrix.variant }}"
exit 1
fi
- name: Check if file exists
id: check_file
run: |
if [ -f "./${{ matrix.php_version }}/${{ env.DOCKER_FILE }}" ]; then
echo "file_exists=true" >> $GITHUB_ENV
else
echo "file_exists=false" >> $GITHUB_ENV
fi
- name: Build and push
uses: docker/build-push-action@v6
if: env.file_exists == 'true'
with:
context: .
file: ./${{ matrix.php_version }}/${{ env.DOCKER_FILE }}
tags:
ghcr.io/${{ github.repository }}:${{ env.DOCKER_TAG }},
ghcr.io/${{ github.repository }}:${{ env.GITHUB_SHA_SHORT }}
push: true
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max