Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. GitHub Actions
  3. Build And Push Your Docker Images Caching Each Stage To Reduce Build Time

Build And Push Your Docker Images Caching Each Stage To Reduce Build Time

MITShellv8.1.1

A GitHub Action that builds and pushes Docker images with multi-stage caching to drastically reduce CI build times.

GitHubGitHub
351 stars59 forks0 contributors

What is Build And Push Your Docker Images Caching Each Stage To Reduce Build Time?

Docker Build with Cache Action is a GitHub Action that builds Docker images with intelligent layer caching to speed up CI/CD pipelines. It caches each stage of multi-stage Docker builds, pushing and pulling these cached stages from a registry to avoid rebuilding unchanged layers. This solves the problem of slow Docker builds in continuous integration by reusing previously built stages across workflow runs.

Target Audience

Developers and DevOps engineers using GitHub Actions for CI/CD who build Docker images and want to reduce build times, especially those with multi-stage Dockerfiles or complex build processes.

Value Proposition

Developers choose this action because it automates Docker layer caching in a registry-agnostic way, supports multi-stage builds and Docker Compose, and integrates seamlessly with major container registries. Its unique selling point is the ability to cache and reuse individual stages, which is more granular and effective than standard Docker caching.

Overview

:octocat: Build and push docker images caching each stage to reduce build time

Use Cases

Best For

  • Speeding up Docker image builds in GitHub Actions workflows
  • CI/CD pipelines with multi-stage Docker builds
  • Projects using Docker Compose in CI
  • Teams using multiple container registries (Docker Hub, ECR, GitHub Registry)
  • Reducing CI costs by minimizing build times
  • Automating Docker image pushes with conditional logic

Not Ideal For

  • Projects using CI/CD platforms other than GitHub Actions, such as GitLab CI or Jenkins
  • Teams with simple single-stage Docker builds where basic Docker layer caching is sufficient
  • Environments with strict security policies that prohibit pushing intermediate build stages to external registries
  • Workflows requiring highly customized build processes that don't align with the action's predefined caching and push logic

Pros & Cons

Pros

Efficient Multi-Stage Caching

Caches each stage of multi-stage Docker builds by pushing and pulling layers from a registry, significantly reducing build times for complex Dockerfiles. This is core to its value proposition as described in the README.

Broad Registry Compatibility

Works out-of-the-box with major registries like Docker Hub, AWS ECR, GitHub Container Registry, and Google Cloud Registry, minimizing setup friction. The README provides specific examples for each.

Docker Compose Integration

Can parse and build images from Docker Compose files, including support for multiple file overrides and service filtering via regex. This is highlighted as a key feature with practical examples.

Conditional Push Flexibility

Allows conditional image pushing based on workflow triggers (e.g., push or pull_request events) or custom test commands, giving users control over when images are published. The README details this in the push_image_and_stages input.

Cons

BuildKit Incompatibility with Old GitHub Registry

When BuildKit is enabled (default for performance), cache functionality does not work with the deprecated docker.pkg.github.com registry, forcing users to migrate to ghcr.io or disable BuildKit. This is explicitly noted in the README's 'Action supercharged' section.

Cache Reliability Dependencies

Cache effectiveness depends on careful management of base image tags and can be invalidated by Docker limitations, as admitted in the 'Cache is not working?' section, requiring user vigilance to avoid rebuilds.

Complex Setup for Mixed Registries

When using Docker Compose files with services targeting different registries, the action requires multiple configurations, increasing setup complexity and potential for errors. The README warns about this in the compose_file input description.

Frequently Asked Questions

Quick Stats

Stars351
Forks59
Contributors0
Open Issues0
Last commit2 days ago
CreatedSince 2019

Tags

#actions#hacktoberfest#devops#github-actions-docker#build-caching#docker-registry#docker-compose#ci-cd#multi-stage-builds#docker#container-registry#automation#docker-image#github-actions

Included in

GitHub Actions27.6k
Auto-fetched 1 day ago

Related Projects

Update a Docker Hub repository description from README.mdUpdate a Docker Hub repository description from README.md

A GitHub action to update a Docker Hub repository description from README.md

Stars386
Forks53
Last commit11 days ago
Set up Docker BuildxSet up Docker Buildx

:octocat: GitHub Action to set up Docker Buildx

Stars224
Forks14
Last commit5 years ago
Monitor and limit your docker image sizeMonitor and limit your docker image size

:whale: Keep an eye on your docker image size and prevent it from growing too big

Stars134
Forks5
Last commit4 days ago
Build and publish docker images to any registry using KanikoBuild and publish docker images to any registry using Kaniko

Build and push docker images using Kaniko and GitHub actions

Stars124
Forks53
Last commit1 month ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub