DevOps Classroom notes 07/Sep/2026

Java application

git clone https://github.com/spring-projects/spring-petclinic.git

cd spring-petclinic

# java 17
sudo apt update && sudo apt-get install openjdk-17-jdk -y 
java --version
# maven 
sudo apt-get install maven -y 
 mvn --version

# maven command to build code  (run where the pom.xml file present)
mvn clean package -DskipTests

### out put will be target folder and jar/war file
java -jar target/spring-petclinic-4.0.0-SNAPSHOT.jar


FROM ubuntu:latest

RUN apt-get update && apt-get install openjdk-17-jdk -y 

WORKDIR app

ENV JAVA_TOOL_OPTIONS="-Djdk.disableLastCgroup=true"

COPY ./**/spring-petclinic-4.0.0-SNAPSHOT.jar .

RUN chmod 755  spring-petclinic-4.0.0-SNAPSHOT.jar

CMD ["java", "-jar", "spring-petclinic-4.0.0-SNAPSHOT.jar"]

docker run –cgroupns=host -e JAVA_TOOL_OPTIONS=“–add-opens=java.base/jdk.internal.platform=ALL-UNNAMED” -dit –name spring-ubuntu-1 -p8081:8080 spring:1.2-ubuntu

Task

  1. create new dockerfile and take base image ubuntu
  2. install pre-request java17, maven and git
  3. In RUN clone repo and build maven code.
  4. cmd should be run jar file

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Animated Social Media Icons by Acurax Responsive Web Designing Company

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube