-
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathDockerfile
More file actions
30 lines (21 loc) · 708 Bytes
/
Dockerfile
File metadata and controls
30 lines (21 loc) · 708 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
# Use a Maven image to build the application
FROM maven:3.8.4-openjdk-17-slim AS build
# Set the working directory inside the container
WORKDIR /app
# Copy the pom.xml and download dependencies
COPY pom.xml .
RUN mvn dependency:go-offline
# Copy the source code
COPY src ./src
# Build the application
RUN mvn package -Pproduction -DskipTests
# Use a Java image for the runtime environment
FROM openjdk:17-jdk-slim
# Set the working directory inside the container
WORKDIR /app
# Copy the built JAR from the build stage
COPY --from=build /app/target/sarjdev-0.0.1-SNAPSHOT.jar app.jar
# Expose the port your application is running on
EXPOSE 8080
# Start the application
CMD ["java", "-jar", "app.jar"]