mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-20 06:45:50 +00:00
latest
This commit is contained in:
parent
3d02e1b15c
commit
53ef24191b
3 changed files with 5 additions and 14 deletions
14
Dockerfile
14
Dockerfile
|
@ -1,20 +1,10 @@
|
|||
# Use an official OpenJDK runtime as a parent image
|
||||
FROM openjdk
|
||||
FROM openjdk:11
|
||||
|
||||
# Set the working directory inside the container
|
||||
WORKDIR /app
|
||||
|
||||
# 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 -DskipTests
|
||||
|
||||
# Copy the JAR file to the app directory
|
||||
# Copy the built JAR file from the build context
|
||||
COPY target/*.jar app.jar
|
||||
|
||||
# Run the jar file
|
||||
|
|
4
Jenkinsfile
vendored
4
Jenkinsfile
vendored
|
@ -21,15 +21,17 @@ pipeline {
|
|||
steps {
|
||||
script {
|
||||
echo "Building Docker Image..."
|
||||
// Ensure Maven build is executed
|
||||
sh './mvnw clean package -DskipTests'
|
||||
def dockerImage = docker.build("spring-petclinic")
|
||||
echo "Docker Image built: ${dockerImage.id}"
|
||||
// Store the Docker image ID in the environment if needed across stages
|
||||
env.DOCKER_IMAGE_ID = dockerImage.id
|
||||
sh 'ls -la target/'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
post {
|
||||
|
|
|
@ -52,7 +52,6 @@ services:
|
|||
- jenkins_data:/var/jenkins_home
|
||||
- ./jenkins.yaml:/var/jenkins_home/casc_configs/jenkins.yaml
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
- ./target:/var/jenkins_home/target
|
||||
networks:
|
||||
- custom-network
|
||||
|
||||
|
|
Loading…
Reference in a new issue