A MiniBox file is the blueprint that tellsDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/chaitu426/minibox/llms.txt
Use this file to discover all available pages before exploring further.
minibox how to assemble an OCI-compliant container image. It combines a small set of top-level directives with indented block instructions to express a fully parallel, DAG-based build graph — keeping images lean while maximising build speed.
The file must be named
MiniBox (formerly Boxfile). Place it at the root of your build context and run minibox build -t <name> . to start a build.File Structure
Every MiniBox file follows the same three-part skeleton:BASE, BLOCK, START, HEALTHCHECK) must have no leading whitespace. Instructions inside a block must be indented by at least 4 spaces or one tab.
Top-Level Directives
BASE
| Syntax | Resolver |
|---|---|
BASE alpine:latest | Docker Hub OCI pull |
BASE ghcr.io/user/repo:tag | Custom OCI registry pull |
BASE scratch | Empty filesystem (static binaries) |
BASE my-custom-base:latest | Local previously-built image |
BASE ./rootfs.tar.gz | Local tar or tar.gz archive |
BLOCK
NEED / BNEED edges.
START
START directive is allowed per file and it must appear at the top level.
HEALTHCHECK
Health field (starting → healthy / unhealthy).
| Flag | Default | Description |
|---|---|---|
--interval=N | 30 | Seconds between probe invocations |
Healthcheck metadata is stored as OCI config labels (
mini.healthcheck.cmd and mini.healthcheck.interval) and is visible in minibox ps.Block Instructions
All instructions below must appear inside aBLOCK — indented by at least 4 spaces or one tab.
NEED vs BNEED
These two dependency directives control both execution ordering and what lands in the final image.NEED — Runtime Dependency
The target block must finish before this block starts. Its filesystem layers are included in the final exported image, stacked beneath this block’s layer.Use
NEED when your block genuinely needs packages, shared libraries, or files from another block at runtime.BNEED — Build-time Dependency
The target block must finish before this block starts. Its filesystem layers are NOT included in the final image unless files are explicitly copied with
COPY FROM=.Use BNEED when you only need artifacts from a builder stage — the heavy compiler toolchain stays out of production.RUN
chroot of the current overlay filesystem during the build. MiniBox automatically mounts /proc, /sys, /dev, and /tmp (mode 1777) so tools like apt, npm, and pip work correctly.
COPY
When
COPY FROM=<block> is used, <block> is automatically added to the current block’s BNeeds list — you don’t need a separate BNEED directive.AUTO-DEPS
WORKDIR and runs the appropriate dependency installer inside the chroot. The detection order is:
| Manifest file | Command run |
|---|---|
package.json | npm install |
requirements.txt | pip install -r requirements.txt |
go.mod | go mod download |
Cargo.toml | cargo build |
AUTO-DEPS always runs after all explicit instructions in the block have been executed.
WORKDIR
RUN commands in this block and configures the container’s default working directory. The path is created if it does not exist.
ENV
RUN commands) and the final image config (available at runtime).
PKG
apk add --no-cache <package> under the hood. When a version is specified with @, it expands to apk add --no-cache <package>=<version>* to allow patch-level updates.
PKG is specialised for Alpine Linux (apk). For Debian/Ubuntu base images, use RUN apt-get install -y <package> directly.PORT
minibox ps.
USER
RUN commands and the final container process will run as. The user must already exist in the image’s /etc/passwd.
VOLUME
Multi-Stage Size Optimisation
TheBNEED + COPY FROM= pattern is the canonical way to build lean images. The builder stage compiles or installs everything; the runtime stage cherry-picks only the necessary artifacts.
Create a builder block
Install dev tools, compilers, or heavy dev dependencies and produce artifacts.
Create a runtime block with BNEED
BNEED builder tells MiniBox to wait for the builder to finish but exclude its layers from the final image.Copy only what you need
Use
COPY FROM=builder to bring compiled binaries or pre-built modules into the runtime block.Complete Examples
Node.js — Four-Block Runtime/Source/Deps/Config Pattern
This is the recommended structure for Node.js applications. The four blocks stay maximally cache-stable: installing system packages, copying source, runningnpm install, and setting config are all independent concerns.
runtimeandsourcehave no dependencies → they run in parallel in Wave 1.depsneeds both → Wave 2, runsnpm installwith the full overlay in place.configjust sets metadata → Wave 3, instant.- Changing only source files invalidates
sourceanddepsbut notruntime(packages don’t reinstall).
Node.js — Lean Build with BNEED
Use this pattern when you want production-only artifacts without dev dependencies in the final image.Go — Static Binary from Scratch
BASE scratch starts with a completely empty filesystem. Combined with a statically linked Go binary this produces the smallest possible image.
BASE can only be set at the top level of the file, not inside a BLOCK. All blocks share the same base filesystem declared at the top. To start with an empty filesystem, set BASE scratch at the top of the file.Legacy Format Aliases
For backward compatibility with olderBoxfile syntax, the following aliases are recognised in flat files (no BLOCK or BASE keyword). The modern DAG format is strongly preferred for all new projects.
View legacy alias table
View legacy alias table
| Legacy directive | Modern equivalent |
|---|---|
BOX / FROM / START-WITH | BASE |
ADD-PACKAGE <pkg> | PKG <pkg> (→ apk add --no-cache) |
INSTALL-DEPS | auto-deps (or RUN npm install) |
CLONE-REPO <url> | RUN git clone <url> |
RUN-COMMAND <cmd> | RUN <cmd> |
GOTO-FOLDER <path> | WORKDIR <path> |
SET-ENVIRONMENT KEY VALUE | ENV KEY=VALUE |
IMPORT-FILE <src> <dest> | COPY <src> <dest> |
GRAB-ALL / SYNC-PACK | COPY . /app |
LAUNCH <cmd> | START <cmd> |