Untitled
unknown
plain_text
a year ago
565 B
2
Indexable
Never
# Use the official Maven image to build the Java application FROM maven:3.8.4-openjdk-11-slim AS build # Set the working directory in the container WORKDIR /app # Copy the source code into the container COPY MyApp.java /app/ # Build the Java application with Maven RUN mvn clean package # Use the official OpenJDK image to run the application FROM openjdk:11-jre-slim # Copy the built JAR file from the previous stage COPY --from=build /app/target/myapp.jar /app/myapp.jar # Run the Java application CMD ["java", "-jar", "/app/myapp.jar"]