Docker - Build image from Mendix Deployment Archive (.mda) file

0
Hi everyone, I am trying to build docker image from .mda ( Mendix Deployment Archive) file. But it is not working . As mentioned in Mendix docker documentation We have to download Mendix build pack and then we have to copy our mendix project folder into build pack folder then we run build command its works fine. But in docker file ,mentioned one more way i.e “ Dockerfile to create a Mendix Docker image based on either the source code or Mendix Deployment Archive (aka mda file)” . Anyone know how to build image from .mda file .
asked
3 answers
0

Hi vijayakumar t,

Did you succeed in generating the docker image from the .mda file?

Thanks!

answered
0

Hello all, 

 

It seems that, despite the fact the Docker file comments that MDA is one of the ways acceped to generate Docker image files, I guess that it's not possible indeed…

 

 

When you try to execute the command below, with the *.mda in the ./project folder

docker build --build-arg BUILD_PATH=./project/app.mda -t mendix/docker_app .

we get the error below:

1.141 Traceback (most recent call last):
1.141   File "/opt/mendix/buildpack/./compilation.py", line 101, in <module>
1.141     replace_cf_dependencies()
1.141   File "/opt/mendix/buildpack/./compilation.py", line 37, in replace_cf_dependencies
1.141     mx_version = runtime.get_runtime_version("/opt/mendix/build")
1.141                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1.141   File "/opt/mendix/buildpack/buildpack/core/runtime.py", line 121, in get_runtime_version
1.141     raise Exception("No model/metadata.json or .mpr found in archive")
1.141 Exception: No model/metadata.json or .mpr found in archive

by inspecting the python code, seems that it's not expecting a *.mda whatsoever

 

 

 

So that only the MPR file is accepted…

 

However, as you mentioned, if you open a terminal and run the command below in the docker-mendix-buildpack folder, with your mendix source copied to the ./project folder, it works

docker build -t mendix/docker-app:1.0 .

 

EDIT:

 

By looking carefuly in the python code, notice that the code is trying to create a filename using "model” and “metadata.json”…

And these files are inside the MDA…

 

So, if you extract the contents of the MDA file inside the <docker-mendix-buildpack>/.project folder and run the docker build command again, it will work !!

And much faster than when using the MPR !!

 

Hope this helps...

 

 

answered
0

Hi Vinicius, when you unzip the MDA or MPK into the project folder it will work. The documentation states

BUILD_PATH indicates where the application model is located. It is a root directory of an unzipped .MDA or .MPK file. In the latter case, this is the directory where your .MPR file is located. Must be within build context. Defaults to ./project.

 

 

answered