docker-mendix-buildpack icon indicating copy to clipboard operation
docker-mendix-buildpack copied to clipboard

Unable to build image using mda file

Open vijayakumar-t opened this issue 5 years ago • 5 comments

Hi, I am able to build image by copy entire project folder into buildpack folder. But i am not able to build image using .mda file . In detail,

  1. Created .mda file from Mendix pro
  2. Created one project folder under Mendix-buildpack folder
  3. Copied and paste that mda file into project folder under mendix-buildpack
  4. Run build command from cmd, its executing commands one by one from Dockerfile finally throws an error as "Exception: No model/metadata.json or .mpr found in archive"

Is there possibility to build image from mda file or not. Please clarify my doubt.

======================= This is the error i am facing

Traceback (most recent call last): File "/opt/mendix/buildpack/buildpack/runtime.py", line 89, in get_version with open(file_name) as file_handle: FileNotFoundError: [Errno 2] No such file or directory: '/opt/mendix/build/model/metadata.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/opt/mendix/buildpack/buildpack/compile.py", line 141, in preflight_check() File "/opt/mendix/buildpack/buildpack/compile.py", line 63, in preflight_check mx_version_str = runtime.get_version(BUILD_DIR) File "/opt/mendix/buildpack/buildpack/runtime.py", line 95, in get_version raise Exception("No model/metadata.json or .mpr found in archive") Exception: No model/metadata.json or .mpr found in archive Traceback (most recent call last): File "./compilation", line 66, in exit_code = call_buildpack_compilation() File "./compilation", line 37, in call_buildpack_compilation return subprocess.check_call(["/opt/mendix/buildpack/buildpack/compile.py", BUILD_PATH, CACHE_PATH]) File "/usr/lib/python3.6/subprocess.py", line 311, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['/opt/mendix/buildpack/buildpack/compile.py', '/opt/mendix/build', '/tmp/buildcache']' returned non-zero exit status 1. The command '/bin/sh -c mkdir -p /tmp/buildcache /var/mendix/build /var/mendix/build/.local && chmod +rx /opt/mendix/buildpack/compilation /opt/mendix/buildpack/git /opt/mendix/buildpack/buildpack/compile.py && cd /opt/mendix/buildpack && ./compilation /opt/mendix/build /tmp/buildcache && rm -fr /tmp/buildcache /tmp/javasdk /tmp/opt /tmp/downloads /opt/mendix/buildpack/compilation /opt/mendix/buildpack/git && ln -s /opt/mendix/.java /opt/mendix/build && chgrp -R 0 /opt/mendix /var/mendix && chmod -R g=u /opt/mendix /var/mendix' returned a non-zero code: 1

vijayakumar-t avatar Nov 19 '20 14:11 vijayakumar-t

From the documentation:

"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."

With emphasis on unzipped ;-)

MXClyde avatar Nov 19 '20 14:11 MXClyde

Hi . Thanks for the quick reply. In Dockerfile mentioned like create image by source code or mda file. Please have a look at following 2 cases case 1: image In this case1 when i am trying to build it is working

case 2: image In this case2 i am not able to run command successfully.

This is the screenshot of Docker file image

Please clarify me whether we build from mda file or not.

Thanks.

vijayakumar-t avatar Nov 19 '20 14:11 vijayakumar-t

As documented, you have to unzip the .MDA file into a subdirectory of the buildpack (e.g. using winzip or something) . Then you can build from that as well.

MXClyde avatar Nov 19 '20 14:11 MXClyde

Now its clear to me .Thanks for the quick support .

vijayakumar-t avatar Nov 19 '20 14:11 vijayakumar-t

I have the same issue.. Please help here

parulmishra20 avatar Apr 19 '22 09:04 parulmishra20