Sign inSign up

miget/migetpacks

By miget

Updated 10 days ago

Zero-config buildpacks for 14 languages. No Dockerfile needed.

Image
Developer tools
1

10K+

miget/migetpacks repository overview

migetpacks

Auto-detecting buildpacks for container images - automatically detects your language, version, and builds optimized container images using official upstream Docker images.

Built by miget.com - Unlimited apps, one price.

License Docker Image

Features

  • Zero Config - Automatically detects language, version, and builds your app
  • 14 Languages - Node.js, Deno, Bun, Python, Ruby, Go, Rust, Java, Kotlin, Scala, Clojure, .NET, PHP, Elixir
  • Secure by Default - Optional Docker Hardened Images (distroless, CVE-free)
  • Multi-Buildpack - Combine languages (e.g., Ruby + Node.js for asset compilation)
  • Procfile Support - Standard process definitions
  • Non-root Runtime - All containers run as non-root user
  • Fast Builds - BuildKit layer caching and registry-based caching

Requirements

  • Docker Desktop (macOS/Windows) or Docker Engine (Linux)
  • BuildKit enabled (default in Docker Desktop 4.0+)

migetpacks runs Docker-in-Docker using BuildKit for optimized multi-stage builds. It requires access to the Docker socket (/var/run/docker.sock).

# Verify Docker is running
docker info

# Verify BuildKit is available
docker buildx version

Quick Start

Docker
# Build your app
docker run --rm \
  -v /path/to/your/app:/workspace/source \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -e OUTPUT_IMAGE=my-app:latest \
  miget/migetpacks:latest

# Run your app
docker run -p 5000:5000 my-app:latest
GitHub Actions (GitHub-hosted runners)

For ephemeral ubuntu-latest runners, use registry-based caching via CACHE_IMAGE:

name: Build and Push

on:
  push:
    branches: [main]

jobs:
  build:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      packages: write

    steps:
      - uses: actions/checkout@v4

      - name: Log in to GitHub Container Registry
        uses: docker/login-action@v3
        with:
          registry: ghcr.io
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}

      # Required for CACHE_IMAGE support
      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v3

      - name: Build and push with migetpacks
        run: |
          docker run --rm \
            -v ${{ github.workspace }}:/workspace/source:ro \
            -v /var/run/docker.sock:/var/run/docker.sock \
            -v /home/runner/.docker/config.json:/root/.docker/config.json:ro \
            -e OUTPUT_IMAGE=ghcr.io/${{ github.repository }}:${{ github.sha }} \
            -e CACHE_IMAGE=ghcr.io/${{ github.repository }}:cache \
            miget/migetpacks:latest
GitHub Actions (Self-hosted runners)

For persistent self-hosted runners, use local file cache via BUILD_CACHE_DIR:

name: Build and Push

on:
  push:
    branches: [main]

jobs:
  build:
    runs-on: self-hosted

    steps:
      - uses: actions/checkout@v4

      - name: Log in to registry
        uses: docker/login-action@v3
        with:
          registry: registry.example.com
          username: ${{ secrets.REGISTRY_USERNAME }}
          password: ${{ secrets.REGISTRY_PASSWORD }}

      - name: Build and push with migetpacks
        run: |
          docker run --rm \
            -v ${{ github.workspace }}:/workspace/source:ro \
            -v /var/run/docker.sock:/var/run/docker.sock \
            -v $HOME/.docker/config.json:/root/.docker/config.json:ro \
            -v /var/cache/migetpacks:/cache \
            -e OUTPUT_IMAGE=registry.example.com/my-app:${{ github.sha }} \
            -e BUILD_CACHE_DIR=/cache \
            miget/migetpacks:latest

Cache options:

  • CACHE_IMAGE - Registry-based BuildKit layer cache. Requires docker/setup-buildx-action. Works on ephemeral runners.
  • BUILD_CACHE_DIR - Local directory for package manager caches (npm, pip, bundler, etc.). Best for persistent self-hosted runners.

Supported Languages

LanguageDetectionVersion Source
Node.jspackage.json.nvmrc, .node-version, package.json
Denodeno.json, deno.jsoncdeno.json
Bunbun.lockb, bunfig.tomlpackage.json
Pythonrequirements.txt, Pipfile, pyproject.toml.python-version, runtime.txt
RubyGemfile.ruby-version, Gemfile
Gogo.modgo.mod
RustCargo.tomlCargo.toml
PHPcomposer.json, index.phpcomposer.json
Javapom.xml, build.gradlepom.xml, .java-version, system.properties
Kotlinbuild.gradle.ktssystem.properties
Scalabuild.sbtsystem.properties
Clojureproject.clj, deps.ednsystem.properties
.NET*.csproj, *.fsprojglobal.json, *.csproj
Elixirmix.exsmix.exs, .elixir-version
DockerfileDockerfile-
Composecompose.yaml, docker-compose.yml-

Environment Variables

VariableRequiredDefaultDescription
OUTPUT_IMAGEYes-Target image name (e.g., ghcr.io/user/app:tag)
SOURCE_DIRNo/workspace/sourceSource code directory
LANGUAGENoauto-detectedForce language (see values below)
RUN_COMMANDNofrom ProcfileOverride the run command
PORTNo5000Application port
ARCHNox86_64Target architecture (x86_64, arm64)
PROJECT_PATHNo-Subdirectory for monorepo builds
BUILDPACKSNoauto-detectedExplicit buildpack order (e.g., ruby,nodejs)
DOCKERFILE_PATHNo-Custom Dockerfile path (forces dockerfile language)
COMPOSE_FILENo-Custom compose file path (forces compose language)
RESULT_FILENo-Path to write build results JSON
STORAGE_DRIVERNooverlay2Docker storage driver (e.g., fuse-overlayfs for nested DinD)
Caching Options
VariableRequiredDefaultDescription
CACHE_IMAGENo-Registry image for BuildKit cache
CACHE_MODENominBuildKit cache export mode: min (final layer) or max (all layers)
CACHE_FROMNo-Additional read-only cache sources (comma-separated registry refs)
CACHE_REGISTRY_INSECURENofalseSet to true for HTTP registries
NO_CACHENofalseForce fresh build, skips cache-from
BUILD_CACHE_DIRNo-Directory for package manager cache
REGISTRY_MIRRORNo-Docker registry mirror URL
Docker Hardened Images
VariableRequiredDefaultDescription
USE_DHINofalseUse Docker Hardened Images from dhi.io
DHI_USERNAMENo-DHI registry username (alternative to mounting docker config)
DHI_PASSWORDNo-DHI registry password/token
DHI_MIRRORNo-DHI registry mirror URL
Custom Build Environment Variables

Any environment variable passed to migetpacks that is not a known configuration variable will be automatically injected into the generated Dockerfile as ENV statements. This allows you to pass custom build-time settings without modifying migetpacks.

# Pass NODE_OPTIONS to increase heap size for large builds
docker run --rm \
  -v ./my-app:/workspace/source \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -e OUTPUT_IMAGE=my-app:latest \
  -e NODE_OPTIONS="--max-old-space-size=4096" \
  miget/migetpacks:latest

# Pass multiple custom variables
docker run --rm \
  -v ./my-app:/workspace/source \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -e OUTPUT_IMAGE=my-app:latest \
  -e NODE_OPTIONS="--max-old-space-size=4096" \
  -e VITE_API_URL="https://api.example.com" \
  -e MY_BUILD_FLAG="true" \
  miget/migetpacks:latest

Common use cases:

  • NODE_OPTIONS="--max-old-space-size=4096" - Increase Node.js heap for large builds
  • VITE_* / NEXT_PUBLIC_* - Frontend build-time variables
  • RAILS_MASTER_KEY - Rails credentials key for asset precompilation
  • Custom feature flags for conditional compilation

Note: Sensitive variables like AWS_* credentials and Docker configuration are automatically filtered out and never injected into the Dockerfile.

LANGUAGE Values

Force a specific language by setting LANGUAGE:

ValueDescription
nodejsNode.js (npm, yarn, pnpm)
denoDeno runtime
bunBun runtime
pythonPython (pip, uv)
rubyRuby (bundler)
goGo
rustRust (cargo)
phpPHP (FrankenPHP + Composer)
javaJava (Maven or Gradle)
kotlinKotlin (Gradle)
scalaScala (sbt)
clojureClojure (Leiningen)
.net or dotnet.NET / C#
elixirElixir (Mix)
dockerfileUse project's Dockerfile directly
composeBuild all services from compose.yaml

Procfile Support

Define processes in a Procfile:

web: bundle exec puma -C config/puma.rb
worker: bundle exec sidekiq
release: bundle exec rails db:migrate

Priority order:

  1. RUN_COMMAND environment variable
  2. web: process from Procfile
  3. First process in Procfile
  4. Language-specific default

Multi-Buildpack

Build apps with multiple languages:

# Ruby app with Node.js for asset compilation
docker run --rm \
  -v ./my-rails-app:/workspace/source \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -e OUTPUT_IMAGE=my-rails-app:latest \
  -e BUILDPACKS=ruby,nodejs \
  miget/migetpacks:latest

Docker Hardened Images

Use minimal, CVE-free Docker Hardened Images:

docker run --rm \
  -v ./my-app:/workspace/source \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -e OUTPUT_IMAGE=my-app:latest \
  -e USE_DHI=true \
  miget/migetpacks:latest

DHI images are distroless (no shell, no apt-get) with minimal attack surface.

Docker Desktop (Mac/Windows)

Docker Desktop stores credentials in the system keychain, not in ~/.docker/config.json. Extract credentials and pass them as environment variables:

# Extract credentials from Docker Desktop keychain
DHI_USERNAME=$(echo "dhi.io" | docker-credential-desktop get | jq -r '.Username')
DHI_PASSWORD=$(echo "dhi.io" | docker-credential-desktop get | jq -r '.Secret')

# Build with DHI
docker run --rm \
  -v "$(pwd):/workspace/source:ro" \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -e OUTPUT_IMAGE=my-app:local \
  -e ARCH=arm64 \
  -e USE_DHI=true \
  -e DHI_USERNAME="$DHI_USERNAME" \
  -e DHI_PASSWORD="$DHI_PASSWORD" \
  miget/migetpacks:latest

Dockerfile & Compose Support

Custom Dockerfile

migetpacks prioritizes its optimized builds for known languages. A Dockerfile is only used as a fallback when no supported language is detected. To force your Dockerfile, use LANGUAGE=dockerfile:

# Force Dockerfile mode (recommended when you have both language files and Dockerfile)
docker run --rm \
  -v ./my-app:/workspace/source \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -e OUTPUT_IMAGE=my-app:latest \
  -e LANGUAGE=dockerfile \
  miget/migetpacks:latest

# Fallback behavior (uses Dockerfile only if no language detected)
docker run --rm \
  -v ./my-app:/workspace/source \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -e OUTPUT_IMAGE=my-app:latest \
  miget/migetpacks:latest

# Use custom Dockerfile path
docker run --rm \
  -v ./my-app:/workspace/source \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -e OUTPUT_IMAGE=my-app:latest \
  -e DOCKERFILE_PATH=docker/Dockerfile.prod \
  miget/migetpacks:latest
Docker Compose

Multi-service builds from compose.yaml:

# compose.yaml
services:
  api:
    build: ./api
  web:
    build: ./web
# Auto-detect compose file
docker run --rm \
  -v ./my-project:/workspace/source \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -e OUTPUT_IMAGE=ghcr.io/user/myproject:latest \
  miget/migetpacks:latest
# Builds: ghcr.io/user/myproject-api:latest, ghcr.io/user/myproject-web:latest

# Force compose mode
docker run --rm \
  -v ./my-project:/workspace/source \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -e OUTPUT_IMAGE=ghcr.io/user/myproject:latest \
  -e LANGUAGE=compose \
  miget/migetpacks:latest

Monorepo Support

Build a specific subdirectory:

docker run --rm \
  -v ./monorepo:/workspace/source \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -e PROJECT_PATH=services/api \
  -e OUTPUT_IMAGE=my-api:latest \
  miget/migetpacks:latest

Build Caching

Package Manager Cache

Mount a cache directory for npm, pip, bundler, cargo, etc.:

docker run --rm \
  -v ./my-app:/workspace/source \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v /path/to/cache:/cache \
  -e OUTPUT_IMAGE=my-app:latest \
  -e BUILD_CACHE_DIR=/cache \
  miget/migetpacks:latest
Registry Cache

Use BuildKit's registry-based caching for Docker layer caching:

docker run --rm \
  -v ./my-app:/workspace/source \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -e OUTPUT_IMAGE=ghcr.io/user/my-app:latest \
  -e CACHE_IMAGE=ghcr.io/user/my-app-cache \
  miget/migetpacks:latest

Private Registry Authentication

When pushing to private registries, migetpacks needs access to your Docker credentials. Since migetpacks runs inside a container, you must mount the Docker config directory.

Docker
# Log in to your registry first
docker login registry.example.com

# Mount the docker config so migetpacks can push
docker run --rm \
  -v ./my-app:/workspace/source \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v ~/.docker/config.json:/root/.docker/config.json:ro \
  -e OUTPUT_IMAGE=registry.example.com/my-app:latest \
  miget/migetpacks:latest
GitHub Actions
- name: Log in to registry
  uses: docker/login-action@v3
  with:
    registry: registry.example.com
    username: ${{ secrets.REGISTRY_USERNAME }}
    password: ${{ secrets.REGISTRY_PASSWORD }}

- name: Build and push with migetpacks
  run: |
    docker run --rm \
      -v ${{ github.workspace }}:/workspace/source:ro \
      -v /var/run/docker.sock:/var/run/docker.sock \
      -v /home/runner/.docker/config.json:/root/.docker/config.json:ro \
      -e OUTPUT_IMAGE=registry.example.com/my-app:${{ github.sha }} \
      -e CACHE_IMAGE=registry.example.com/my-app:cache \
      miget/migetpacks:latest

Key points:

  • Mount config.json file only (buildx needs to create state in .docker/buildx/)
  • Use :ro (read-only) for the config file
  • On GitHub-hosted runners, the path is /home/runner/.docker/config.json
  • On self-hosted runners, use $HOME/.docker/config.json

Build Results

Get structured JSON output for CI/CD pipelines:

docker run --rm \
  -v ./my-app:/workspace/source \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v /tmp/results:/output \
  -e OUTPUT_IMAGE=my-app:latest \
  -e RESULT_FILE=/output/result.json \
  miget/migetpacks:latest

cat /tmp/results/result.json
{
  "status": "success",
  "images": [{"name": "my-app:latest", "ports": ["5000/tcp"]}],
  "processes": {"web": "node server.js"},
  "language": "nodejs",
  "build_time": 45
}

Examples

Working examples for all languages in examples/:

  • nodejs-example, deno-example, bun-example
  • python-example, ruby-example, php-hello-world
  • go-hello-world, rust-example
  • java-hello-world, kotlin-example, scala-example
  • dotnet-hello-world, elixir-example
  • dockerfile-example, compose-example

Development

# Run detection tests
make test-detect

# Build the container locally
make build

# Test a language build
make test-nodejs
make test-python
make test-go

About

migetpacks is built by miget.com - unlimited apps, one price. We use migetpacks to build customer apps with zero configuration.

License

O'Saasy License (Modified for Cloud/PaaS) - see LICENSE for details.

Tag summary

Content type

Image

Digest

sha256:965dcc1ee

Size

288.7 MB

Last updated

10 days ago

docker pull miget/migetpacks