-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
34 lines (24 loc) · 825 Bytes
/
Dockerfile
File metadata and controls
34 lines (24 loc) · 825 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Use an official OpenJDK runtime with Java 21 as the base image
FROM eclipse-temurin:21-jdk-jammy as builder
# Set the working directory inside the container
WORKDIR /app
# Copy the Maven Wrapper files
COPY mvnw .
COPY .mvn .mvn
# Copy the Maven project files
COPY pom.xml .
COPY src ./src
# Make the mvnw script executable
RUN chmod +x mvnw
# Build the application using Maven
RUN ./mvnw clean package -DskipTests
# Use a smaller base image for the final stage
FROM eclipse-temurin:21-jre-jammy
# Set the working directory
WORKDIR /app
# Copy the built JAR file from the builder stage
COPY --from=builder /app/target/sales-agent-*.jar app.jar
# Expose the port your app runs on (change 8080 if your app uses a different port)
EXPOSE 8080
# Define the command to run the application
CMD ["java", "-jar", "app.jar"]