Cant build docker image in Mendix app

0
HI with reference to this link https://docs.mendix.com/developerportal/deploy/docker-deploy/ , I tried to containerize app. We followed the step by step process But when we try to build the image using docker with the help of this command docker build --build-arg BUILD_PATH="{relative-mendix-project-location}" -t {image name} . we are getting an error as command incorrect while execute. Can anyone suggest how to execute and build the docker image.
asked
1 answers
1

Hi Kacipriya,

This is the instructions I followed when running a Mendix application locally using Docker and PostgreSQL. It is assumed that Docker, and its required dependencies, has already been installed.

  1. Download the Mendix-Docker build pack from GitHub
    1. Download the archive/ZIP-file here
  2. Extract the Mendix-Docker build pack into a location of your choice
    1. Pro tip: It would help to rename it to your project name, such as My Project
  3. Copy your project folder into the extracted build pack folder
    1. From Mendix Studio Pro, App > Show App Directory in Explorer
    2. Step 3a will take you inside the project folder.
      1. From here you can navigate a single level up and copy the project folder and past the folder as is in the extracted build pack folder; OR
      2. From here you can copy the content of the project folder and paste it into a dedicated folder in the extracted build pack folder
    3. Pro tip: It would help to rename your project folder inside the extracted build pack folder to project
  4. Using Windows Command Prompt, navigate to the extracted build pack folder
    1. Assuming you followed step 2a, the following should suffice
      1. cd ./Documents/My Project
  5. Build the project image (according to the Mendix documentation)
    1. Inside Command Prompt, run the following command:
      1. docker build --build-arg BUILD_PATH="{relative-mendix-project-location}" -t {imageName}:{tag} .
    2. Assuming you followed step 3c, the following should suffice:
      1. docker build --build-arg BUILD_PATH=./project -t myproject:latest .
    3. Note: The full stops are required!
  6. Build the project image (according to the build pack documentation)
    1. Inside Command Prompt, run the following command:
      1. docker build --build-arg BUILD_PATH=<mendix-project-location> --build-arg ROOTFS_IMAGE=<root-fs-image-tag> --build-arg BUILDER_ROOTFS_IMAGE=<root-fs-image-tag> --build-arg CF_BUILDPACK=<cf-buildpack-version> --tag mendix/mendix-buildpack:v1.2 .
    2. Assuming that the default values are sufficient, the following should suffice
      1. docker build --build-arg BUILD_PATH=./project --build-arg ROOTFS_IMAGE=mendix/rootfs:ubi8 --build-arg BUILDER_ROOTFS_IMAGE=mendix/rootfs:bionic --build-arg CF_BUILDPACK=v4.24.0 --tag mendix/mendix-buildpack:v1.2 .
    3. Disclaimer: Always RTFM!
  7. Finally run the image
    1. Inside Command Prompt, run the following command:
      1. docker run -it -e ADMIN_PASSWORD=AdminPassword1! -e DATABASE_ENDPOINT=postgres://{username}:{password}@{host}:{port}/{databaseName} -p 8080:8080 mendix/mendix-buildpack:v1.2
    2. Assuming that the default values are sufficient, the following should suffice
      1. docker run -it -e ADMIN_PASSWORD=AdminPassword1! -e DATABASE_ENDPOINT=postgres://postgres:postgres@host.docker.internal:5432/MyProjectDB -p 8080:8080 mendix/mendix-buildpack:v1.2

And that's it! Some additional tips:

  • This method seems not to want to create the PostgreSQL database (although it synchronizes fine), therefor, create the database beforehand
  • If you are re-using a database, ensure that there are not any users whose password does not meet the project's password policy (MxAdmin is usually a culprit)

 

Hope it helps!

answered