Documentation Index
Fetch the complete documentation index at: https://mintlify.com/mikronita/mikrom/llms.txt
Use this file to discover all available pages before exploring further.
mikrom-builder is the build engine for the Mikrom platform. It listens on NATS for build requests from mikrom-api, clones the target Git repository into a temporary workspace, detects the application stack (or falls back to a provided Dockerfile), builds an OCI-compliant container image using BuildKit, and pushes the result to the configured registry. Build logs and status updates are reported back over NATS so the dashboard and CLI can stream progress in real time.
Responsibilities
Git Cloning
Clones the source repository into an ephemeral workspace for each build. Supports authenticated and anonymous repositories.
Stack Detection
Auto-detects the application framework and selects the appropriate build strategy—Railpack for source-driven builds, or Dockerfile for explicit configurations.
OCI Image Build
Builds images using BuildKit. Supports both Dockerfile-based and Railpack source-driven build paths.
Registry Push
Pushes the built image to the configured OCI registry with optional authentication credentials.
NATS Integration
Receives build requests and reports build logs, metrics, and completion status back to
mikrom-api over NATS.Concurrency Control
Limits simultaneous builds with a configurable cap (
MAX_CONCURRENT_BUILDS) to protect host resources.Supported Application Stacks
mikrom-builder auto-detects the following stacks when no Dockerfile is present in the repository root. Detection uses Railpack’s heuristics:
Phoenix
Ruby on Rails
Django
Laravel
Go
Rust
JavaScript
Static
When a
Dockerfile is present at the repository root, the builder uses it directly and skips stack detection. The Docker build path takes precedence over Railpack.Build Pipeline
Build request arrives via NATS
mikrom-api publishes a build request to NATS containing the Git repository URL, branch or commit reference, and any build-time environment variables.Repository cloned
The builder clones the repository into a temporary directory using
git2. The workspace is cleaned up after the build completes or fails.Build strategy selected
The builder checks for a
Dockerfile at the repository root. If found, it is used directly. Otherwise, Railpack analyses the repository and generates a build plan for the detected stack.Image built with BuildKit
The build is submitted to the BuildKit daemon configured in
BUILDKIT_HOST. The builder uses the bollard crate (Docker API client) to drive the build and stream log output.Image pushed to registry
The finished image is tagged and pushed to the registry specified in
REGISTRY. If REGISTRY_USER and REGISTRY_PASS are set, authenticated pushes are used.BuildKit Daemon
mikrom-builder requires a running BuildKit daemon. In local development, BuildKit is managed via Docker Compose.
BUILDKIT_HOST:
BUILDKIT_HOST at the BuildKit daemon socket or address for your deployment environment.
Configuration
| Variable | Default | Description |
|---|---|---|
NATS_URL | nats://[::1]:4222 | NATS server URL for build request subscriptions |
REGISTRY | registry.mikrom.spluca.org/mikrom | Target OCI registry for pushed images |
REGISTRY_URL | alias for REGISTRY | Backward-compatible environment name |
REGISTRY_USER | — | Registry username for authenticated pushes |
REGISTRY_PASS | — | Registry password for authenticated pushes |
BUILDKIT_HOST | docker-container://mikromrust-buildkit-1 | BuildKit daemon address |
MAX_CONCURRENT_BUILDS | 2 | Maximum number of simultaneous builds |
BUILD_STATE_TTL_SECS | 3600 | Retention window for build state (seconds) |
BUILD_STATE_PATH | /tmp/mikrom-builder-state.json | Persistent build state file path |
ENABLE_TELEMETRY | true | Enable OTLP export for traces and metrics |
Build State Persistence
The builder persists build state toBUILD_STATE_PATH. This file survives process restarts, so in-flight build status is not lost if the service is restarted during a build.
Build metrics are also exposed over NATS for querying by the scheduler and API:
Stack
Dockerfile
The builder ships a multi-stageDockerfile for containerized deployments:
Local Development
The ignored NATS integration tests are exercised by
make ci-external-tests. These tests verify the full build-request-to-status-report loop and require a live NATS server.