asapdotid / docker-build-workflow

A Reusable Workflow of the Docker GitHub Actions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Docker Build and Push GitHub Actions Workflow

Lint Code Base Docker Build

A Reusable Workflow of the Docker GitHub Actions steps. Enhanced with learnings from production use.

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.

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 repos 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 (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 layer caching
  7. Reports tags and labels in the PR comments

This repository is part of my example repos on GitHub Actions

More reading

πŸŽ‰πŸŽ‰πŸŽ‰ Join my container DevOps community πŸŽ‰πŸŽ‰πŸŽ‰

About

A Reusable Workflow of the Docker GitHub Actions

License:The Unlicense


Languages

Language:Dockerfile 100.0%