Skip to main content
Version: v11.10.0

Building Project with Docker


This guide walks you through building a WAR file for your WaveMaker application using Docker. This approach provides a containerized and isolated environment, making it easier to manage dependencies and ensure consistent builds.

System prerequisites

Before proceeding, ensure the following prerequisites are met:

  • Docker Installed: Download and install Docker for your operating system from Docker's official site.
  • WaveMaker Application Project: Ensure you have a WaveMaker project ready for build.

Build War File Using Docker

To generate the WAR file locally using Docker, follow the steps below. This approach is helpful if you want a containerized, isolated environment for the build process.

Basic Command

Run the following Docker command, replacing <your_project_location> with the path to your local project folder and <wavemaker_version> with version of WaveMaker Application :

docker run --rm -e profile=<profile_name> -v <your_project_location>:/usr/local/content/app wavemakerapp/app-builder:<wavemaker_version>

Example:

docker run -rm -e profile=deployment -v /home/user/MySampleApp:/usr/local/content/app wavemakerapp/app-builder

This command mounts your project directory to the container, builds the application, and generates the WAR file in the specified directory.

Optimized Command with Maven and npm Cache

For faster and more efficient builds, you can specify custom Maven and npm cache locations. This setup reduces the need to download dependencies each time by caching them locally.

Replace <local_m2_cache_location>, <local_npm_cache_location> and <your_project_location> with the appropriate paths on your system. For <wavemaker_version>, specify the WaveMaker release version, or set the tag to "latest" (or leave it out) to push the latest version automatically.

docker run --rm -e profile=<profile_name> -e MAVEN_CONFIG=$HOME/.m2 \
-v <local_m2_cache_location>:$HOME/.m2 \
-v <local_npm_cache_location>:$HOME/.npm \
-v <your_project_location>:/usr/local/content/app \
wavemakerapp/app-builder:<wavemaker_version>

Example:

docker run --rm -e profile=deployment -e MAVEN_CONFIG=$HOME/.m2 \
-v ~/.m2:$HOME/.m2 \
-v ~/.npm:$HOME/.npm \
-v /home/user/MySampleApp:/usr/local/content/app \
wavemakerapp/app-builder

Run by Mapping Host User in Docker

If you encounter file access or permission issues while working with files outside the container, you can run the container as the host user by using the -u $(id -u):$(id -g) option. This ensures that files created or modified by the container are owned by the host user.

Replace <local_m2_cache_location>, <local_npm_cache_location> and <your_project_location> with the appropriate paths on your system. For <wavemaker_version>, specify the WaveMaker release version, or set the tag to "latest" (or leave it out) to push the latest version automatically.

docker run --rm -u $(id -u):$(id -g) \
-e profile=<profile_name> -e MAVEN_CONFIG=$HOME/.m2 \
-v <local_m2_cache_location>:$HOME/.m2 \
-v <local_npm_cache_location>:$HOME/.npm \
-v <your_project_location>:/usr/local/content/app \
wavemakerapp/app-builder:<wavemaker_version>

Example:

docker run --rm -u $(id -u):$(id -g) \
-e profile=deployment -e MAVEN_CONFIG=$HOME/.m2 \
-v ~/.m2:$HOME/.m2 \
-v ~/.npm:$HOME/.npm \
-v /home/user/MySampleApp:/usr/local/content/app \
wavemakerapp/app-builder

Explanation of Options

  • -e profile=<profile_name>: Sets the build profile.
  • -e MAVEN_CONFIG=$HOME/.m2: Specifies the location for Maven configuration and cache files.
  • -v <local_m2_cache_location>:$HOME/.m2: Maps your local Maven cache, speeding up dependency resolution.
  • -v <local_npm_cache_location>:$HOME/.npm: Maps your local npm cache, improving build efficiency for projects using npm.
  • -v <your_project_location>:/usr/local/content/app: Maps your project directory to the container’s working directory.
  • -u $(id -u):$(id -g): Ensures that the container runs with the host user's UID and GID, resolving file permission issues.

Note: Make sure that the specified directories exist and have the correct permissions for Docker to access them.

note

The wavemakerapp/app-builder Docker image is packed with required software packages and libraries to deploy WaveMaker Application in Docker containers.