Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

mxcli docker build

The mxcli docker build command builds a Mendix application using mxbuild in Docker, including support for PAD (Platform-Agnostic Deployment) patching.

Usage

mxcli docker build -p app.mpr

What It Does

  1. Downloads mxbuild – Automatically downloads the correct mxbuild version for your project if not already available
  2. Runs mxbuild – Executes the Mendix build toolchain in a Docker container
  3. PAD patching – Applies Platform-Agnostic Deployment patches (Phase 1) to the build output
  4. Produces artifact – Generates a deployable Mendix deployment package (MDA file)

PAD Patching

PAD (Platform-Agnostic Deployment) patching modifies the build output to be compatible with container-based deployment platforms. This is essential for deploying Mendix applications to Kubernetes, Cloud Foundry, or other container orchestrators.

The build command applies six patches automatically after MxBuild produces the PAD output:

#PatchApplies ToDescription
1Set bin/start execute permissionAll versionsZIP extraction does not preserve the +x flag. This patch runs chmod 0755 on bin/start so the container can execute the start script.
2Fix Dockerfile CMD (start.sh -> start)11.6.x onlyMxBuild 11.6.x generates CMD ["./bin/start.sh"] but the actual script is named start (no .sh extension).
3Remove config argumentAll versionsRemoves the "etc/Default" argument from the CMD line. The bin/start script accumulates args with CONFIG_FILES="$CONFIG_FILES $1", which produces a leading space (" etc/Default") that the runtime rejects. Without the argument, bin/start uses its own DEFAULT_CONF variable.
4Replace deprecated base imageAll versionsReplaces FROM openjdk:21 with FROM eclipse-temurin:21-jre. The openjdk Docker images are deprecated and no longer maintained.
5Add HEALTHCHECKAll versionsInserts a HEALTHCHECK instruction before the CMD line: `curl -f http://localhost:8080/
6Bind admin API to all interfacesAll versionsAppends admin.addresses = ["*"] to the PAD config file (etc/Default). Without this, the admin API (port 8090) only listens on localhost inside the container and is unreachable from outside even when the port is mapped.

Patches are applied idempotently – if a patch has already been applied (e.g., from a previous build), it is skipped. The build output shows the status of each patch:

Applying patches...
  [applied] Set bin/start execute permission
  [skipped] Fix Dockerfile CMD (start.sh -> start)
  [applied] Remove config arg from Dockerfile CMD
  [applied] Replace deprecated openjdk base image
  [applied] Add HEALTHCHECK instruction
  [applied] Bind admin API to all interfaces

Validation with mx check

To validate a project without building:

mxcli docker check -p app.mpr

This runs mx check against the project and reports any errors:

Checking app for errors...
The app contains: 0 errors.

Auto-Download mxbuild

mxcli automatically downloads the correct mxbuild version for your project:

# Explicit setup
mxcli setup mxbuild -p app.mpr

# Or let docker build handle it automatically
mxcli docker build -p app.mpr

The downloaded mxbuild is cached at ~/.mxcli/mxbuild/{version}/ for reuse.