Error while creating Docker Image

0
Hi,   I am creating a Docker image for an application and followed the Mendix documentation: Downloaded the Mendix Docker Buildpack. Copied the project folder and all its subfolders to the unzipped Docker build folder. Executed the command: docker build --build-arg BUILD_PATH=. -t first-mendix-image . After reviewing the error log, I identified that the error is due to the /mxbuild.exe file or directory not being available.   Error Log:   docker build --build-arg BUILD_PATH=. -t first-mendix-image .[+] Building 135.8s (18/22)                                                                      docker:default => [internal] load build definition from Dockerfile                                                       0.0s => => transferring dockerfile: 5.70kB                                                                     0.0s => [internal] load metadata for docker.io/mendix/rootfs:ubi8                                              2.1s => [internal] load metadata for docker.io/mendix/rootfs:bionic                                            2.1s => [auth] mendix/rootfs:pull token for registry-1.docker.io                                               0.0s => [internal] load .dockerignore                                                                          0.0s => => transferring context: 2B                                                                            0.0s => [stage-1  1/10] FROM docker.io/mendix/rootfs:ubi8@sha256:d83f37bf9165b7a62aa884c4f5d469824ded8a478a89  0.0s => [internal] load build context                                                                          0.2s => => transferring context: 107.68kB                                                                      0.2s => [builder 1/6] FROM docker.io/mendix/rootfs:bionic@sha256:224b5416da0efb128bc1d526fbb03b80a68cc26b4f05  0.0s => CACHED [builder 2/6] RUN mkdir -p /opt/mendix/buildpack /opt/mendix/build &&    ln -s /root /home/vca  0.0s => CACHED [builder 3/6] COPY scripts/compilation scripts/git /opt/mendix/buildpack/                       0.0s => CACHED [builder 4/6] COPY . /opt/mendix/build                                                          0.0s => CACHED [builder 5/6] RUN chmod +rx /opt/mendix/buildpack/bin/bootstrap-python && /opt/mendix/buildpac  0.0s => CACHED [stage-1  2/10] RUN chmod g=u /etc/passwd &&    chown 1001:0 /etc/passwd                        0.0s  => CACHED [stage-1  3/10] RUN if [ "true" = "true" ] && grep -q ubuntu /etc/os-release ; then        DEB  0.0s => CACHED [stage-1  4/10] COPY scripts/startup scripts/vcap_application.json /opt/mendix/build/           0.0s  => CACHED [stage-1  5/10] RUN mkdir -p /home/vcap /opt/datadog-agent/run &&    chown -R 1001:0 /home/vca  0.0s  => CACHED [stage-1  6/10] RUN chmod +rx /opt/mendix/build/startup &&    chown -R 1001:0 /opt/mendix &&    0.0s  => ERROR [builder 6/6] RUN mkdir -p /tmp/buildcache /tmp/cf-deps /var/mendix/build /var/mendix/build/.  133.4s ------ > [builder 6/6] RUN mkdir -p /tmp/buildcache /tmp/cf-deps /var/mendix/build /var/mendix/build/.local &&    chmod +rx /opt/mendix/buildpack/compilation /opt/mendix/buildpack/git /opt/mendix/buildpack/buildpack/stage.py &&    cd /opt/mendix/buildpack &&    ./compilation /opt/mendix/build /tmp/buildcache /tmp/cf-deps 0 &&    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 &&    chown -R 1001:0 /opt/mendix /var/mendix &&    chmod -R g=u /opt/mendix /var/mendix:0.750 INFO: Mendix project compilation phase...1.035 INFO: Preflight check on Mendix version [10.6.11.39264] and stack [None]...1.035 INFO: Mendix [10.6] is not maintained. Please use a medium- or long-term supported Mendix version to easily receive fixes (https://docs.mendix.com/releasenotes/studio-pro/lts-mts).1.035 INFO: Preflight check completed1.036 INFO: Building from source...1.036 INFO: Selecting Mono Runtime: 5133.0 Cannot open assembly '/opt/mendix/build/.local/mxbuild/modeler/mxbuild.exe': No such file or directory.   133.0 ERROR: Could not read MxBuild error file133.0 Traceback (most recent call last):133.0   File "/opt/mendix/buildpack/buildpack/core/mxbuild.py", line 70, in build_from_source133.0     subprocess.check_call(args, env=mono_env)133.0   File "/usr/lib/python3.6/subprocess.py", line 311, in check_call133.0     raise CalledProcessError(retcode, cmd)133.0 subprocess.CalledProcessError: Command '['/tmp/opt/mono-5.20.1.27/bin/mono', '--config', '/tmp/opt/mono-5.20.1.27/etc/mono/config', '/opt/mendix/build/.local/mxbuild/modeler/mxbuild.exe', '--target=package', '--output=/tmp/model.mda', '--java-home=/opt/mendix/build/.local/usr/lib/jvm/Adoptium-jdk-11.0.16-Adoptium-x64', '--java-exe-path=/opt/mendix/build/.local/usr/lib/jvm/Adoptium-jdk-11.0.16-Adoptium-x64/bin/java', '--write-errors=/tmp/builderrors.json', '/opt/mendix/build/Docker Mendix POC.mpr']' returned non-zero exit status 2.133.0133.0 During handling of the above exception, another exception occurred:133.0133.0 Traceback (most recent call last):133.0   File "/opt/mendix/buildpack/buildpack/core/mxbuild.py", line 117, in _log_buildstatus_errors133.0     with codecs.open(error_file, "r", encoding="utf-8-sig") as errorfile:133.0   File "/usr/lib/python3.6/codecs.py", line 897, in open133.0     file = builtins.open(filename, mode, buffering)133.0 FileNotFoundError: [Errno 2] No such file or directory: '/tmp/builderrors.json'133.0 ERROR: MxBuild returned errors: {"problems": [{"severity": "Error", "message": "Failed to build the model,please check application logs for details.", "locations": []}]}133.0 ERROR: Command '['/tmp/opt/mono-5.20.1.27/bin/mono', '--config', '/tmp/opt/mono-5.20.1.27/etc/mono/config', '/opt/mendix/build/.local/mxbuild/modeler/mxbuild.exe', '--target=package', '--output=/tmp/model.mda', '--java-home=/opt/mendix/build/.local/usr/lib/jvm/Adoptium-jdk-11.0.16-Adoptium-x64', '--java-exe-path=/opt/mendix/build/.local/usr/lib/jvm/Adoptium-jdk-11.0.16-Adoptium-x64/bin/java', '--write-errors=/tmp/builderrors.json', '/opt/mendix/build/Docker Mendix POC.mpr']' returned non-zero exit status 2.133.0 /opt/mendix/buildpack/buildpack/infrastructure/database.py:8: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography. The next release of cryptography (40.0) will be the last to support Python 3.6.133.0   from cryptography.hazmat.primitives import serialization133.0 /opt/mendix/buildpack/buildpack/infrastructure/database.py:8: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography. The next release of cryptography (40.0) will be the last to support Python 3.6.133.0   from cryptography.hazmat.primitives import serialization133.0 Traceback (most recent call last):133.0   File "./compilation", line 67, in <module>133.0     exit_code = call_buildpack_compilation()133.0   File "./compilation", line 40, in call_buildpack_compilation133.0     return subprocess.check_call(["/opt/mendix/buildpack/buildpack/stage.py", BUILD_PATH, CACHE_PATH, DEPS_DIR, DEPS_IDX])133.0   File "/usr/lib/python3.6/subprocess.py", line 311, in check_call133.0     raise CalledProcessError(retcode, cmd)133.0 subprocess.CalledProcessError: Command '['/opt/mendix/buildpack/buildpack/stage.py', '/opt/mendix/build', '/tmp/buildcache', '/tmp/cf-deps', '0']' returned non-zero exit status 1.------Dockerfile:70--------------------  69 |     # 8. Update permissions of /opt/mendix so that the app can run as a non-root user  70 | >>> RUN mkdir -p /tmp/buildcache /tmp/cf-deps /var/mendix/build /var/mendix/build/.local &&\  71 | >>>     chmod +rx /opt/mendix/buildpack/compilation /opt/mendix/buildpack/git /opt/mendix/buildpack/buildpack/stage.py &&\  72 | >>>     cd /opt/mendix/buildpack &&\  73 | >>>     ./compilation /opt/mendix/build /tmp/buildcache /tmp/cf-deps 0 &&\  74 | >>>     rm -fr /tmp/buildcache /tmp/javasdk /tmp/opt /tmp/downloads /opt/mendix/buildpack/compilation /opt/mendix/buildpack/git &&\  75 | >>>     ln -s /opt/mendix/.java /opt/mendix/build &&\  76 | >>>     chown -R ${USER_UID}:0 /opt/mendix /var/mendix &&\  77 | >>>     chmod -R g=u /opt/mendix /var/mendix  78 |--------------------ERROR: failed to solve: process "/bin/sh -c mkdir -p /tmp/buildcache /tmp/cf-deps /var/mendix/build /var/mendix/build/.local &&    chmod +rx /opt/mendix/buildpack/compilation /opt/mendix/buildpack/git /opt/mendix/buildpack/buildpack/stage.py &&    cd /opt/mendix/buildpack &&    ./compilation /opt/mendix/build /tmp/buildcache /tmp/cf-deps 0 &&    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 &&    chown -R ${USER_UID}:0 /opt/mendix /var/mendix &&    chmod -R g=u /opt/mendix /var/mendix" did not complete successfully: exit code: 1   Thanks
asked
1 answers
1

You can try the procedure described in this article:

Containerize your Mendix Application with Docker

 

answered