This application is designed for practicing the deployment process for Java Spring Boot-based applications.
-
Clone the Repository:
Clone this repository using:
git clone https://github.com/luchichang/Simple-Java-Spring-Boot-Application.git
-
Install Apache Maven: Apache Maven is used as the build automation tool for this application. If Maven is not already installed, follow the official installation guide.
sudo apt update -y sudo apt install maven -yMaven is a build automation tool primarily for Java projects. -
Build the Application:
Navigate to the project directory and run:
mvn clean packageThis command performs the following actions: * clean: Removes previously compiled code and build artifacts to ensure a fresh build. * package: Compiles the code, runs tests, and packages the application into a JAR or WAR file as specified in the pom.xml file.
- Run the Application:
After the build process completes, the generated .jar file will be located in the target directory. To run the application, use:
java -jar target/spring-boot-web.jarThe application will start and be accessible at http://localhost:8080.
build the Image in the docker file
docker build -t basicspringbootapp:v1 .
run the container and forward the application to port 8010
```docker
docker run -d --name container1 -p "8010:8080" basicspringbootapp:v1
```
-
Optional:
For a visual reference, you can view the attached image:
Project Credits: https://github.com/iam-veeramalla