Docker Buildpack v6 contains a breaking change and might require some changes in your CI/CD pipeline:
Building Mendix projects from source (*.mpr or *.mpk files) is now done using a build.py script. If your CI/CD pipeline uses Docker Buildpack to build *.mda files (compiled Mendix apps), no further changes are needed.
If you're upgrading from Docker Buildpack v4 (or an older version), you'll also need to follow the upgrading from Docker Buildpack v4 instructions.
Docker Buildpack v6 no longer uses CF Buildpack to compile MPR (or MPK) files - to continue supporting newer versions of Mendix, Java and the base OS.
Instead, a custom build.py script will:
- Prepare a clean Docker context in the path specified by
--destination. All files required to build the app image will be copied to this destination. If the directory doesn't exist, thebuild.pyscript will create it; if the directory is not empty,build.pywill delete its contents. - Detect the file type of the source path specified by the
--sourcearg (an MPK file, an MPR file, an MDA file or an unpacked MDA directory). - If necessary (
--sourcespecifies project that needs to be compiled)- Create an image containing mxbuild and its dependencies.
- Run an
mxbuildin a container, and copy the resulting MDA contents to the destination path specified by--destination.
- Otherwise (
--sourcespecifies a path to an MDA file or unpacked MDA directory),build.shwill just copy the MDA contents to the destination path specified by--destination.
Once the build.py script runs successfully, the path specified by --destination will contain a Docker context and everything needed to run a docker build command.
There instructions are provided as a reference, based on a typical pipeline. Your CI/CD pipeline might be different - for support with updating a custom pipeline, please check the Mendix Support Policy.
- Verify your pipeline image or runner has Python 3.8 available, and uses a UNIX-like operating system (Linux, macOS or Windows Subsystem for Linux).
- Locate the
docker buildstep in your CI/CD pipeline that builds the app image. This should be the step that builds the Mendix app, and not the rootfs or its dependencies. Anydocker buildcommands that build the rootfs should not be changed. - Before the
docker buildstep, add the following lines (replacing<path-to-source>with the path to the project source, and<destination-dir>with an empty/temporary writable path):./build.py --source <path-to-source> --destination <destination-dir> build-mda-dir
- In the
docker buildstep:- Remove
--build-arg BUILD_PATHargs. - Remove
-fand--fileargs specifying a Dockerfile, if they exist. - Update the Docker context path to the
<destination-dir>.
- Remove
After the update, your pipeline might look like this:
# Preparation steps
# Downloag Docker Buildpack
DOCKER_BUILDPACK_VERSION=v6.0.1
curl -LJ -o - https://github.com/mendix/docker-mendix-buildpack/archive/refs/tags/${DOCKER_BUILDPACK_VERSION}.tar.gz | tar --strip-components=1 -xvz
# Checkout the Mendix app source
git clone <mendix-app-git> mendix-app-src
# Build the Mendix app from mendix-app-src to a temporary location
./build.py --source mendix-app-src --destination /tmp/docker-buildpack-context build-mda-dir
# Prepare and push the Docker image, using /tmp/docker-buildpack-context as the Docker context
docker build --tag example.com/mendix-app:latest /tmp/docker-buildpack-context
docker push example.com/mendix-app:latest
# Follow-up stepsDocker Buildpack v6 switched from ubi8 to ubi9 images (Red Hat Universal Base Images) whenever possible.
Building Mendix 8 and 9 apps still uses ubi8, as those versions depend on an older version of Mono that doesn't work in newer operating systems.