mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-20 14:55:50 +00:00
fix: change the dockerfile back to the one that works
This commit is contained in:
parent
549f0255c4
commit
bee774e2fa
2 changed files with 25 additions and 26 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -21,3 +21,4 @@ zap-report/*
|
||||||
sonarqube_data
|
sonarqube_data
|
||||||
sonarqube_extensions
|
sonarqube_extensions
|
||||||
sonarqube_logs
|
sonarqube_logs
|
||||||
|
jenkins_data
|
||||||
|
|
16
Dockerfile
16
Dockerfile
|
@ -1,5 +1,7 @@
|
||||||
# First stage: Build the application using Maven
|
# Use an official OpenJDK runtime as a parent image
|
||||||
FROM maven:3.8.1-openjdk-17 AS build
|
FROM openjdk
|
||||||
|
|
||||||
|
# Set the working directory inside the container
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy the Maven wrapper and the pom.xml file
|
# Copy the Maven wrapper and the pom.xml file
|
||||||
|
@ -10,14 +12,10 @@ COPY mvnw pom.xml ./
|
||||||
COPY src ./src
|
COPY src ./src
|
||||||
|
|
||||||
# Package the application
|
# Package the application
|
||||||
RUN ./mvnw package
|
RUN ./mvnw clean package -DskipTests
|
||||||
|
|
||||||
# Second stage: Use an official OpenJDK runtime as a parent image
|
# Copy the JAR file to the app directory
|
||||||
FROM openjdk
|
COPY target/*.jar app.jar
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
# Copy the JAR file from the build stage
|
|
||||||
COPY --from=build /app/target/*.jar app.jar
|
|
||||||
|
|
||||||
# Run the jar file
|
# Run the jar file
|
||||||
CMD ["java", "-jar", "app.jar"]
|
CMD ["java", "-jar", "app.jar"]
|
||||||
|
|
Loading…
Reference in a new issue