Merge pull request #6 from CChariot/FinalProject_main

Final project main
This commit is contained in:
88ning 2024-07-28 18:43:04 -07:00 committed by GitHub
commit bce7750a3a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 53 additions and 24 deletions

View file

@ -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"]

32
Jenkinsfile vendored
View file

@ -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 {

View file

@ -35,6 +35,7 @@ services:
depends_on:
- prometheus
jenkins:
build:
context: .

View file

@ -5,4 +5,9 @@ scrape_configs:
- job_name: 'spring-boot-app'
metrics_path: '/actuator/prometheus'
static_configs:
- targets: ['petclinic:8080']
- targets: ['petclinic:8080']
- job_name: 'jenkins'
metrics_path: '/prometheus'
static_configs:
- targets: ['localhost:8081']