GithubHelp home page GithubHelp logo

jleeluit / docker-build-workflow Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bretfisher/docker-build-workflow

0.0 1.0 0.0 70 KB

A Reusable Workflow of the Docker GitHub Actions

License: The Unlicense

Dockerfile 100.00%

docker-build-workflow's Introduction

Template: Docker Build GitHub Actions Workflow

Lint Code Base Docker 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: Adds SBOM 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" workflow templates/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 just docker build?"

  1. Clone the repository
  2. Setup QEMU for multi-platform building (via buildx) via docker/setup-qemu-action
  3. Setup buildx for awesome and fast building via docker/setup-buildx-action
  4. Log into Docker Hub and/or GHCR
  5. Add labels and tags via docker/metadata-action
  6. Build and push image via docker/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 my github-actions-templates repository. It calls the reusable reusable-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 🎉🎉🎉

docker-build-workflow's People

Contributors

bretfisher avatar dependabot[bot] avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.