Builder Configuration
These environment variables control how migetpacks builds your application.| Variable | Required | Default | Description |
|---|---|---|---|
SOURCE_DIR | No | /workspace/source | Source code directory |
OUTPUT_IMAGE | Yes | - | Target image name (e.g., registry.io/app:tag) |
LANGUAGE | No | auto-detected | Programming language override |
RUN_COMMAND | No | from Procfile/default | Command to run the application |
PORT | No | 5000 | Port the application listens on |
ARCH | No | x86_64 | Target architecture (x86_64, arm64) |
PROJECT_PATH | No | - | Subdirectory within SOURCE_DIR for monorepo support |
DOCKERFILE_PATH | No | - | Custom Dockerfile path (relative to PROJECT_PATH or absolute) |
COMPOSE_FILE | No | - | Custom compose file path (auto-detects compose.yaml, compose.yml, docker-compose.yaml, docker-compose.yml) |
BUILDPACKS | No | auto-detected | Explicit buildpack order (e.g., ruby,python,nodejs - first is primary) |
TAG_LATEST | No | false | Also tag image with :latest in addition to primary tag |
RESULT_FILE | No | - | Path to write build results JSON (for Shipwright post-build steps) |
STORAGE_DRIVER | No | overlay2 | Docker storage driver override (e.g., fuse-overlayfs for nested DinD) |
Caching Options
These variables configure build caching for faster subsequent builds.| Variable | Required | Default | Description |
|---|---|---|---|
CACHE_IMAGE | No | - | Registry image for BuildKit cache |
CACHE_REGISTRY_INSECURE | No | false | Set to true for HTTP registries (e.g., internal cache registry) |
NO_CACHE | No | false | Force fresh build (--no-cache), skips cache-from but still exports to cache-to |
CACHE_MODE | No | min | BuildKit cache export mode: min (final layer only, smaller) or max (all layers, better hits) |
CACHE_FROM | No | - | Additional read-only cache sources (comma-separated registry refs, skipped when NO_CACHE=true) |
REGISTRY_MIRROR | No | - | Docker registry mirror URL (e.g., https://registry.example.io/mirror) |
BUILD_CACHE_DIR | No | - | Shared cache directory for package managers (mount RWX volume here) |
Docker Hardened Images
These variables enable Docker Hardened Images for secure, minimal containers.| Variable | Required | Default | Description |
|---|---|---|---|
USE_DHI | No | false | Use Docker Hardened Images (dhi.io) for secure, minimal runtime containers |
DHI_USERNAME | No | - | DHI registry username (alternative to mounting docker config) |
DHI_PASSWORD | No | - | DHI registry password/token |
DHI_MIRROR | No | - | DHI registry mirror URL (e.g., https://registry.example.io/dhi-io) |
External Private Registry
Set these variables when yourDockerfile pulls a base image from a private registry (any FROM <private-host>/... line). The builder runs docker login before invoking the build, so subsequent pulls authenticate. Values may come from the environment directly or from the platform’s BUILD_VARS JSON envelope.
| Variable | Required | Default | Description |
|---|---|---|---|
EXTERNAL_REGISTRY_URL | No | - | Registry host (e.g., docker.io, ghcr.io, registry.digitalocean.com, <account>.dkr.ecr.<region>.amazonaws.com). No protocol prefix. |
EXTERNAL_REGISTRY_USERNAME | No | - | Username (or token name where the provider uses it as the username, e.g., AWS for ECR). |
EXTERNAL_REGISTRY_PASSWORD | No | - | Password or read-only access token. Read-only tokens are recommended. |
docker build, matching the DHI block’s behaviour.
Example
docker
Custom Environment Variables
Any environment variable passed to migetpacks that is not in the known builder variables list is automatically injected into the generated Dockerfile as anENV statement. This allows you to configure your application’s build environment without modifying any configuration files.
How It Works
- You pass an environment variable to the migetpacks container (e.g.,
-e NODE_OPTIONS="--max-old-space-size=4096") - The builder checks whether it matches any known builder variable pattern
- If it does not match, it is added to the generated Dockerfile as an
ENVinstruction - The variable becomes available during both the build and runtime stages
Common Use Cases
Node.js heap size
Node.js heap size
Increase the V8 heap size for large builds that run out of memory:
Frontend build-time variables
Frontend build-time variables
Inject variables consumed by Vite, Next.js, or similar frameworks during the build:
Rails credentials
Rails credentials
Provide the master key so Rails can decrypt credentials during asset precompilation:
Custom build flags
Custom build flags
Pass arbitrary flags to your build tooling:
Filtered Variables
The following categories of variables are never passed through to the Dockerfile:- Builder config:
SOURCE_DIR,OUTPUT_IMAGE,LANGUAGE,BUILD_COMMAND,RUN_COMMAND,PORT,ARCH,CACHE_IMAGE,NO_CACHE,CACHE_MODE,CACHE_FROM,BUILDPACKS,USE_DHI,REGISTRY_MIRROR,RESULT_FILE,STORAGE_DRIVER, etc. - Language-specific: Go build flags, Scala/sbt options, Clojure/Leiningen settings
- Credentials:
AWS_*variables (never exposed in images) - Docker/system:
DOCKER_HOST,DOCKER_CONFIG,DOCKER_BUILDKIT, etc. - Shell/system:
PATH,HOME,PWD,TERM,SHELL,USER,HOSTNAME,LANG,LC_*,XDG_*,SSH_*, etc.
Build-arg name requirements
App environment variables reach the build through the platform’sBUILD_VARS envelope and are projected as Docker build args (--build-arg flags and generated ARG lines). Build args — like shell variables and Dockerfile ARG/ENV keys — must be POSIX identifiers (IEEE Std 1003.1 §8.1): a letter or underscore followed by letters, digits, or underscores, i.e. ^[A-Za-z_][A-Za-z0-9_]*$.
Keys that don’t satisfy this rule — for example dotted settings such as discovery.seed_hosts (used by Elasticsearch and other JVM apps) — are skipped from the build-arg projection and logged. They are still delivered to the running container as ordinary environment variables; they simply cannot be build args, because ARG discovery.seed_hosts is not a valid Dockerfile instruction.
- Runtime env (Compose Specification, permissive): keys are preserved verbatim.
- Build args (POSIX / Docker
ARG): only identifier-safe keys are projected; the rest are runtime-only.