We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 452606c commit dccb067Copy full SHA for dccb067
1 file changed
Dockerfile
@@ -0,0 +1,28 @@
1
+# Stage 1: Build the application
2
+FROM maven:3.8.5-eclipse-temurin-11 AS build
3
+
4
+# Set the working directory inside the container
5
+WORKDIR /app
6
7
+# Copy only the module-specific files
8
+ARG module
9
+COPY $module/pom.xml ./pom.xml
10
+COPY $module/src ./src
11
12
+# Build the application
13
+RUN mvn clean package -DskipTests
14
15
+# Stage 2: Package the application in a lightweight runtime
16
+FROM openjdk:11-jre-slim
17
18
19
20
21
+# Copy the JAR file from the build stage
22
+COPY --from=build /app/target/*.jar ./app.jar
23
24
+# Expose the application port (if applicable)
25
+EXPOSE 8080
26
27
+# Command to run the application
28
+CMD ["java", "-jar", "app.jar"]
0 commit comments