This commit is contained in:
Lihan 2024-07-27 21:57:08 -04:00
parent a60b181eb9
commit 19dbd094ec
2 changed files with 2 additions and 5 deletions

View file

@ -14,11 +14,8 @@ COPY src ./src
# Package the application # Package the application
RUN ./mvnw clean package -Dmaven.test.skip=true RUN ./mvnw clean package -Dmaven.test.skip=true
# Verify the build output
RUN ls -alh /app/target/
# Copy the JAR file to the app directory # Copy the JAR file to the app directory
COPY /app/target/spring-petclinic-3.3.0-SNAPSHOT.jar.original app.jar COPY target/*.jar app.jar
# Run the jar file # Run the jar file
CMD ["java", "-jar", "app.jar"] CMD ["java", "-jar", "app.jar"]

2
Jenkinsfile vendored
View file

@ -21,7 +21,7 @@ pipeline {
steps { steps {
script { script {
echo "Building Docker Image..." echo "Building Docker Image..."
def dockerImage = docker.build("spring-petclinic") def dockerImage = docker.build("spring-petclinic", "--no-cache .")
echo "Docker Image built: ${dockerImage.id}" echo "Docker Image built: ${dockerImage.id}"
// Store the Docker image ID in the environment if needed across stages // Store the Docker image ID in the environment if needed across stages
env.DOCKER_IMAGE_ID = dockerImage.id env.DOCKER_IMAGE_ID = dockerImage.id