Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork38
A Reusable Workflow of the Docker GitHub Actions
License
BretFisher/docker-build-workflow
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
A Reusable Workflow of the Docker GitHub Actions steps. Enhanced with learnings from production use.
⚠️ DO NOT call this workflow directly, rather, use it as a template repository and fork it for your own reusable workflow. I might change this workflow at anytime, based on new GHA features or learnings, and your calling workflow might break.⚠️
- 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.
- New in 2023: AddsSBOM and Provenance metadata to your images.
- New in 2023:Example template to use the reusable workflow twice, in an "image promotion" style of dual registries (one for devs and PRs, one for production after PR merges)
- 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.yamlto all the repositories you want to build images in and change it to point to the forked workflow above.
- Clone the repository
- New in 2025:Native multi-platform building for x86_64 and arm64 on GitHub's Runners (if you need other platorms, there's an example of using QEMU 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-actionwith GitHub-based layer caching - Reports tags and labels in the PR comments
I have a more advanced example of using this reusable workflow to do a "promotion" style workflow of:
- On PR creation, build and push to a "dev" registry (GHCR)
- On PR merge, build and push to a "prod" registry (Docker Hub)
- Create a GitOps YAML update PR to update image tags
- Notify of GitOps PR creation in Slack
I've added that example to mygithub-actions-templates repository. It calls the reusablereusable-docker-build.yaml file in this repository.
- bretfisher/github-actions-templates - Main reusable templates repository
- bretfisher/super-linter-workflow - Reusable linter workflow
- (you are here)bretfisher/docker-build-workflow- Reusable Docker build workflow
- bretfisher/docker-ci-automation - Step-by-step video and example of a Docker CI workflow
- My full list of container examples and tools
About
A Reusable Workflow of the Docker GitHub Actions
Topics
Resources
License
Code of conduct
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.