For building and running the application you need:
- JDK 11
- Docker
- Gradle
- Intellij
There are several ways to run a Spring Boot application on your local machine.
One way is to execute the main
method in the CoffeeDigitalApplication
class from your IDE.
Or run the following command in a terminal:
./gradlew bootRun
http://localhost:8080/CoffeeDigital/actuator/health
http://localhost:8080/CoffeeDigital/swagger-ui/index.html
To run graddle project: stay root folder and use command:
./gradlew bootRun
To terminate process use: press Ctrl + C
Run Unit test
./gradlew test
Run the following command:
./gradlew clean build
or run without test:
./gradlew clean build -x test
After build succesfully, we will have a jar file at folder build/libs
.
To start spring appliation from this jar file, run the following command:
java -Dspring.profiles.active=dev -jar ./build/libs/CoffeeDigital-0.0.1-SNAPSHOT.jar
Show place install JDK
java_home -V
/usr/libexec/java_home -V
export PATH=$PATH:/Users/lqnham/Library/Java/JavaVirtualMachines/corretto-17.0.6/Contents/Home/bin
-
build image
sudo docker build -t coffeedigital .
-
To check information
docker ps
-
Mapping port
docker run -p [port_your_pc]:[port_docker] [image_name]
-
port_docker: check on Dockerfile
-
port_your_pc: any available port
-
run image
docker run -p 8080:8080 coffeedigital