From 50abcbcae117d02b079ddfbdc4408a6c321ce895 Mon Sep 17 00:00:00 2001 From: Lihan Date: Sun, 28 Jul 2024 20:59:08 -0400 Subject: [PATCH 1/4] sajdiojqwoe --- Dockerfile | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index ce19ac4ef..cc8bee60a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,37 @@ +## Use an official OpenJDK runtime as a parent image +#FROM openjdk:11-jdk-slim +# +## Set the working directory inside the container +#WORKDIR /app +# +## Copy the JAR file to the app directory (adjust this path according to your actual JAR file name in the target directory) +#COPY target/*.jar app.jar +# +## Run the jar file +#CMD ["java", "-jar", "app.jar"] +# +## Expose the port the app runs on +#EXPOSE 8080 + + # Use an official OpenJDK runtime as a parent image -FROM openjdk:11-jdk-slim +FROM openjdk # Set the working directory inside the container WORKDIR /app -# Copy the JAR file to the app directory (adjust this path according to your actual JAR file name in the target directory) -COPY target/*.jar app.jar +# Copy the Maven wrapper and the pom.xml file +COPY .mvn/ .mvn +COPY mvnw pom.xml ./ + +# Copy the project source code +COPY src ./src + +# Package the application +RUN ./mvnw clean package + +# Copy the JAR file to the app directory +RUN cp /app/target/*.jar app.jar # Run the jar file -CMD ["java", "-jar", "app.jar"] - -# Expose the port the app runs on -EXPOSE 8080 +CMD ["java", "-jar", "app.jar"] \ No newline at end of file From f44e37518180c34b143716f1168ac708da88e603 Mon Sep 17 00:00:00 2001 From: Lihan Date: Sun, 28 Jul 2024 21:07:00 -0400 Subject: [PATCH 2/4] asjduijwq --- docker-compose_spring-petclinic.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose_spring-petclinic.yml b/docker-compose_spring-petclinic.yml index cbad04772..d8418b71e 100644 --- a/docker-compose_spring-petclinic.yml +++ b/docker-compose_spring-petclinic.yml @@ -35,6 +35,7 @@ services: depends_on: - prometheus + jenkins: build: context: . From db60d2e6ff1929d0c2b8cd910d4844bf2c88030a Mon Sep 17 00:00:00 2001 From: Lihan Date: Sun, 28 Jul 2024 21:09:04 -0400 Subject: [PATCH 3/4] updated Jenkinsfile --- Jenkinsfile | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a0428726d..891a7b50d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,23 +8,23 @@ pipeline { } stages { - stage('Checkout') { - steps { - script { - echo "Checking out code..." - git url: 'https://github.com/CChariot/spring-petclinic.git', branch: 'FinalProject_main', credentialsId: 'github-token' - } - } - } + // stage('Checkout') { + // steps { + // script { + // echo "Checking out code..." + // git url: 'https://github.com/CChariot/spring-petclinic.git', branch: 'FinalProject_main', credentialsId: 'github-token' + // } + // } + // } - stage('Build JAR') { - steps { - script { - echo "Building JAR..." - sh './mvnw clean package -Dmaven.test.skip=true' - } - } - } + // stage('Build JAR') { + // steps { + // script { + // echo "Building JAR..." + // sh './mvnw clean package -Dmaven.test.skip=true' + // } + // } + // } stage('Build Docker Image') { steps { From 1ed26790fe1f4ed65392c07c8066bc573b3ae3f6 Mon Sep 17 00:00:00 2001 From: Lihan Date: Sun, 28 Jul 2024 21:38:16 -0400 Subject: [PATCH 4/4] Updated Prometheus yaml file. --- prometheus.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/prometheus.yml b/prometheus.yml index 92143a72b..f7fae4520 100644 --- a/prometheus.yml +++ b/prometheus.yml @@ -5,4 +5,9 @@ scrape_configs: - job_name: 'spring-boot-app' metrics_path: '/actuator/prometheus' static_configs: - - targets: ['petclinic:8080'] \ No newline at end of file + - targets: ['petclinic:8080'] + + - job_name: 'jenkins' + metrics_path: '/prometheus' + static_configs: + - targets: ['localhost:8081'] \ No newline at end of file