From 39c4687fa6a2be077165db66aac817ac7788d820 Mon Sep 17 00:00:00 2001 From: Lihan Date: Sat, 27 Jul 2024 21:28:09 -0400 Subject: [PATCH] revert Dockerfile --- Dockerfile | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 91b031ec3..2dbfce412 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,7 @@ -# First stage: Build the application using Maven -FROM maven:3.8.1-openjdk-17 AS build +# Use an official OpenJDK runtime as a parent image +FROM openjdk + +# Set the working directory inside the container WORKDIR /app # Copy the Maven wrapper and the pom.xml file @@ -10,14 +12,13 @@ COPY mvnw pom.xml ./ COPY src ./src # Package the application -RUN ./mvnw package +RUN ./mvnw clean package -DskipTests -# Second stage: Use an official OpenJDK runtime as a parent image -FROM openjdk -WORKDIR /app - -# Copy the JAR file from the build stage -COPY --from=build /app/target/*.jar app.jar +# Copy the JAR file to the app directory +COPY target/*.jar app.jar # Run the jar file -CMD ["java", "-jar", "app"] \ No newline at end of file +CMD ["java", "-jar", "app.jar"] + +# Expose the port the app runs on +EXPOSE 8080