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