mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-20 06:45:50 +00:00
Merge pull request #6 from CChariot/FinalProject_main
Final project main
This commit is contained in:
commit
bce7750a3a
4 changed files with 53 additions and 24 deletions
37
Dockerfile
37
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"]
|
32
Jenkinsfile
vendored
32
Jenkinsfile
vendored
|
@ -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 {
|
||||
|
|
|
@ -35,6 +35,7 @@ services:
|
|||
depends_on:
|
||||
- prometheus
|
||||
|
||||
|
||||
jenkins:
|
||||
build:
|
||||
context: .
|
||||
|
|
|
@ -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']
|
Loading…
Reference in a new issue