Skip to content

Conversation

@chrisns
Copy link

@chrisns chrisns commented Dec 30, 2025

Summary

This PR adds automated multi-architecture Docker image builds (linux/amd64 and linux/arm64) with automatic publishing to GitHub Container Registry (GHCR).

What's included

  • New workflow: .github/workflows/build-push.yml - Builds and pushes multi-arch images on every push to php* branches
  • Updated README: Documents the new automated build process alongside the existing manual Docker Hub workflow

Benefits

🚫 No rate limiting
Unlike Docker Hub, GHCR has no anonymous pull rate limits. This is particularly valuable for CI/CD pipelines where Docker Hub's 100 pulls/6 hours limit can cause build failures during busy periods.

💰 Cost savings with ARM support
ARM64 instances (AWS Graviton, Azure Ampere, GCP Tau T2A) are typically 20-40% cheaper than equivalent x86 instances while offering comparable or better performance. Adding arm64 support enables the community to run LocalGov Drupal on these more cost-effective platforms.

🔄 Dynamic tagging
The workflow automatically extracts the base image tag from the Dockerfile, so when you update FROM php:8.4-apache, it will automatically tag as php-8.4-apache - no manual tag updates needed.

📦 Works for upstream and forks
Uses ${{ github.repository }} so the same workflow works in the main repo and any forks without modification.

Image locations

Once merged, images will be available at:

ghcr.io/localgovdrupal/drupal-container:php-8.3-apache

Adding Docker Hub publishing (optional)

If you'd also like to automatically push to Docker Hub alongside GHCR, you can add these steps to the workflow:

      - name: Login to Docker Hub
        uses: docker/login-action@v3
        with:
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_TOKEN }}

And update the tags in the build step:

          tags: |
            ghcr.io/${{ github.repository }}:${{ steps.extract-tag.outputs.tag }}
            localgovdrupal/apache-php:${{ github.ref_name }}

This would require adding DOCKERHUB_USERNAME and DOCKERHUB_TOKEN secrets to the repository.


We've verified the workflow works - our fork's build completed successfully and the multi-arch image is functioning correctly:

$ docker buildx imagetools inspect ghcr.io/co-cddo/drupal-container:php-8.3-apache
Manifests: 
  Platform: linux/amd64
  Platform: linux/arm64

We're happy to make any changes you'd suggest - please let us know if you have any feedback or would like us to adjust anything.

- Add GitHub Actions workflow to build and push multi-arch images (amd64/arm64)
- Extract image tag dynamically from Dockerfile base image
- Push to ghcr.io/<owner>/drupal-container:<tag>
- Update README with GHCR documentation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant