fix: change the dockerfile back to the one that works

This commit is contained in:
Nicholas Mucks 2024-07-27 17:45:43 -07:00
parent 549f0255c4
commit bee774e2fa
2 changed files with 25 additions and 26 deletions

1
.gitignore vendored
View file

@ -21,3 +21,4 @@ zap-report/*
sonarqube_data sonarqube_data
sonarqube_extensions sonarqube_extensions
sonarqube_logs sonarqube_logs
jenkins_data

View file

@ -1,26 +1,24 @@
# 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
WORKDIR /app
# Set the working directory inside the container
# Copy the Maven wrapper and the pom.xml file WORKDIR /app
COPY .mvn/ .mvn
COPY mvnw pom.xml ./ # Copy the Maven wrapper and the pom.xml file
COPY .mvn/ .mvn
# Copy the project source code COPY mvnw pom.xml ./
COPY src ./src
# Copy the project source code
# Package the application COPY src ./src
RUN ./mvnw package
# Package the application
# Second stage: Use an official OpenJDK runtime as a parent image RUN ./mvnw clean package -DskipTests
FROM openjdk
WORKDIR /app # Copy the JAR file to the app directory
COPY target/*.jar app.jar
# Copy the JAR file from the build stage
COPY --from=build /app/target/*.jar app.jar # Run the jar file
CMD ["java", "-jar", "app.jar"]
# Run the jar file
CMD ["java", "-jar", "app.jar"] # Expose the port the app runs on
EXPOSE 8080
# Expose the port the app runs on
EXPOSE 8080