Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A Reusable Workflow of the Docker GitHub Actions

License

NotificationsYou must be signed in to change notification settings

BretFisher/docker-build-workflow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lint Code BaseDocker Build

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.⚠️

Reasons to use this workflow

  1. Easier to start with than hand-building all the Docker Actions into a single workflow.
  2. Provides inline docs based on real-world usage of this workflow.
  3. Gives you inputs so you can reuse this workflow across many repositories and only needing the full workflow stored in a central repository.
  4. New in 2023: AddsSBOM and Provenance metadata to your images.
  5. 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)

Steps to adopt this workflow

  1. Fork this repository and tweak the reusable workflow to your liking:.github/workflows/reusable-docker-build.yaml
  2. Copy my "calling" workflowtemplates/call-docker-build.yaml to all the repositories you want to build images in and change it to point to the forked workflow above.

"But what does this workflow really do beyond justdocker build?"

  1. Clone the repository
  2. 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)
  3. Setup buildx for awesome and fast building viadocker/setup-buildx-action
  4. Log into Docker Hub and/or GHCR
  5. Add labels and tags viadocker/metadata-action
  6. Build and push image viadocker/build-push-action with GitHub-based layer caching
  7. Reports tags and labels in the PR comments

What other ways can I use this workflow?

I have a more advanced example of using this reusable workflow to do a "promotion" style workflow of:

  1. On PR creation, build and push to a "dev" registry (GHCR)
  2. On PR merge, build and push to a "prod" registry (Docker Hub)
  3. Create a GitOps YAML update PR to update image tags
  4. 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.

This repository is part of my example DevOps repositories on GitHub Actions

More reading

🎉🎉🎉 Join my cloud native DevOps community 🎉🎉🎉

About

A Reusable Workflow of the Docker GitHub Actions

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

    Packages

     
     
     

    Contributors2

    •  
    •  

    [8]ページ先頭

    ©2009-2025 Movatter.jp