A Reusable Workflow of the Docker GitHub Actions steps. Enhanced with learnings from production use.
- Easier to start with than hand-building all the Docker Actions into a single workflow.
- Provides inline docs based on real-world usage of this workflow.
- Gives you inputs so you can reuse this workflow across many repositories and only needing the full workflow stored in a central repository.
- Fork this repository and tweak the reusable workflow to your liking: .github/workflows/reusable-docker-build.yaml
- Copy my "calling" workflow
templates/call-docker-build.yaml
to all the repos you want to build images in, and change it to point to the forked workflow above.
- Clone the repository
- Setup QEMU for multi-platform building (buildx) via docker/setup-qemu-action
- Setup buildx for awesome and fast building via docker/setup-buildx-action
- Log into Docker Hub and/or GHCR
- Add labels and tags via docker/metadata-action
- Build and push image via docker/build-push-action with layer caching
- Reports tags and labels in the PR comments
- bretfisher/github-actions-templates - Main repository
- bretfisher/super-linter-workflow - Reusable linter workflow
- (you are here) bretfisher/docker-build-workflow- Reusable docker build workflow
- bretfisher/allhands22 - Step by step example of a Docker workflow
- My full list of container examples and tools