Overview

migetpacks integrates with GitHub Actions to build and push container images as part of your CI/CD pipeline. It works with both self-hosted runners (recommended for performance) and GitHub-hosted runners.

Self-Hosted Runner

Self-hosted runners offer the best performance because Docker layer caches and package manager caches persist between builds.
The persistent cache directory (/home/runner/migetpacks-cache) survives runner restarts and dramatically speeds up dependency installation on subsequent builds.

GitHub-Hosted Runner

GitHub-hosted runners do not persist Docker layer caches between runs. Use CACHE_IMAGE for registry-based caching to speed up builds.

Configuration Options

Registry Login

Always authenticate before running migetpacks if you are pushing to a private registry:

Build Cache Directory

BUILD_CACHE_DIR enables shared package manager caching. On self-hosted runners, point this to a persistent directory:

Registry Mirror

REGISTRY_MIRROR configures a pull-through cache for Docker Hub images, reducing image pull times:

Custom Environment Variables

Pass build-time environment variables directly:
Secrets like RAILS_MASTER_KEY are injected as build-time environment variables and will be present in the generated Dockerfile. They are visible in the final image’s environment. Use runtime secrets injection for sensitive values in production.

Full Workflow Example

This complete workflow builds on push to main, tags with both commit SHA and latest, and uses all available caching strategies:

Performance Tips

  • Persistent cache: Use BUILD_CACHE_DIR pointed at a local directory
  • Pre-pull images: Pull common base images during runner initialization
  • Registry mirror: Use REGISTRY_MIRROR for Docker Hub images
  • Local Docker cache: Docker layer cache persists in /var/lib/docker
  • NVMe storage: Use local SSD/NVMe for /var/lib/docker instead of network storage