diff --git a/Dockerfile b/Dockerfile index ee49298..bd4bf4f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Step 1: Use an official Maven image to build the project -FROM docker.io/maven:3.8.8-eclipse-temurin-17 AS build +FROM docker.io/maven:3.9.9-eclipse-temurin-21 AS build # Step 2: Set the working directory inside the container WORKDIR /app @@ -11,7 +11,7 @@ COPY . . RUN mvn clean package # Step 5: Use Tomcat image to deploy the WAR -FROM docker.io/tomcat:jdk17 +FROM docker.io/tomcat:jdk21 # Step 6: Set the working directory inside the Tomcat container WORKDIR /usr/local/tomcat/webapps diff --git a/README.md b/README.md index 31ec7ba..4ac307a 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ The `HelloWorldMainLauncherClass` performs the following tasks: ## Prerequisites -- Java Development Kit (JDK) 8 or higher. +- Java Development Kit (JDK) 21 or higher. - A Java IDE (like IntelliJ IDEA, Eclipse, or NetBeans) or a command-line environment to compile and run the Java program. ## Installation @@ -55,37 +55,28 @@ The `HelloWorldMainLauncherClass` performs the following tasks: To set up and run this project locally, follow these steps: 1. Clone the repository: + ```bash git clone https://github.com/NanowarOfSteel/HelloWorld.git ``` 2. Navigate into the project sources directory: - ```bash - cd HelloWorld/src/main/java - ``` - -3. Compile the Java file: - ```bash - javac it/nanowar/ofsteel/helloworld/HelloWorldMainLauncherClass.java - ``` -4. Run the program: ```bash - javac it/nanowar/ofsteel/helloworld/HelloWorldMainLauncherClass.java + cd HelloWorld ``` -Alternatively, with Java 11 you can compile and run the project in one single step: - 3. Compile and run the Java file: + ```bash - java it/nanowar/ofsteel/helloworld/HelloWorldMainLauncherClass.java + java src/main/java/it/nanowar/ofsteel/helloworld/HelloWorldMainLauncherClass.java ``` ## Usage Once you run the program, you will see the following output: -``` +```text Hello World Programmer Start Hello World! Hello World! @@ -211,13 +202,14 @@ in the root directory of the project, then point out the location of the Dockerfile with the `-f` option: ```bash -docker build -t my-java-app -f src/main/docker/helloworld.dockerfile . +docker build -t my-java-app . ``` This command will: + 1. Use an official Maven image to build the application. 2. Package the application into a JAR file. -3. Use a slim OpenJDK 17 image to run the resulting application (**kinda**). +3. Use a slim OpenJDK 21 image to run the resulting application (**kinda**). ## Usage diff --git a/pom.xml b/pom.xml index 299e450..bdf3e18 100644 --- a/pom.xml +++ b/pom.xml @@ -4,8 +4,8 @@ HelloWorld 0.0.1-SNAPSHOT - 17 - 17 + 21 + 21 @@ -24,14 +24,17 @@ + + org.apache.maven.plugins + maven-war-plugin + 3.4.0 + + nano + + war - - 21 - 21 - - jakarta.servlet @@ -52,17 +55,4 @@ test - - - - - org.apache.maven.plugins - maven-war-plugin - 3.4.0 - - nano - - - -