From 50abcbcae117d02b079ddfbdc4408a6c321ce895 Mon Sep 17 00:00:00 2001 From: Lihan Date: Sun, 28 Jul 2024 20:59:08 -0400 Subject: [PATCH] sajdiojqwoe --- Dockerfile | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index ce19ac4ef..cc8bee60a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,37 @@ +## Use an official OpenJDK runtime as a parent image +#FROM openjdk:11-jdk-slim +# +## Set the working directory inside the container +#WORKDIR /app +# +## Copy the JAR file to the app directory (adjust this path according to your actual JAR file name in the target directory) +#COPY target/*.jar app.jar +# +## Run the jar file +#CMD ["java", "-jar", "app.jar"] +# +## Expose the port the app runs on +#EXPOSE 8080 + + # Use an official OpenJDK runtime as a parent image -FROM openjdk:11-jdk-slim +FROM openjdk # Set the working directory inside the container WORKDIR /app -# Copy the JAR file to the app directory (adjust this path according to your actual JAR file name in the target directory) -COPY target/*.jar app.jar +# 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 + +# Copy the JAR file to the app directory +RUN cp /app/target/*.jar app.jar # Run the jar file -CMD ["java", "-jar", "app.jar"] - -# Expose the port the app runs on -EXPOSE 8080 +CMD ["java", "-jar", "app.jar"] \ No newline at end of file