Packaging the application for local deployment
Now let's build our application and deploy it locally. This can be done in two ways, either using Docker or by building and executing a WAR file.
Building and deploying using Docker
Let's use a Gradle task to build our docker image.
Note
Use the ./gradlew tasks
command to list all available tasks.
- In your Terminal, go to the project root folder and execute;
./gradlew bootRepackage -Pprod buildDocker
:- bootRepackage: Builds an executable archive (WAR) file for the application
- -Pprod: Specifies the profile to use
- buildDocker: Builds a docker image based on the Dockerfile present in the
src/main/docker
folder
Note
If you are using JHipster Version 5 or above, usebootWar
instead of thebootRepackage
command in Gradle.
2. Once the task is completed successfully, we can deploy our app by running:
> docker-compose -f src/main/docker/app.yml up
This will also start the MySQL DB if you haven't started it already. If you already have it running from the previous step...