-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
32 lines (22 loc) · 935 Bytes
/
Dockerfile
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
# First stage: build the application
FROM maven:3.8.5-openjdk-17 AS build
# Set the working directory for the build process
WORKDIR /app
# Copy the pom.xml file and download dependencies
COPY pom.xml .
# Download the dependencies (will be cached if pom.xml doesn't change)
RUN mvn dependency:go-offline
# Copy the entire project source
COPY src ./src
# Run the Maven clean and package commands
RUN mvn clean package -DskipTests
# Second stage: create the runtime image
FROM eclipse-temurin:17-jre-alpine
# Set the working directory in the container
WORKDIR /app
# Copy the Spring Boot JAR file from the build stage
COPY --from=build /app/target/DATA_PIPLINE-0.0.1-SNAPSHOT.jar /app/DATA_PIPLINE-0.0.1-SNAPSHOT.jar
# Expose the port your Spring Boot application listens on (default is 8080)
EXPOSE 8081
# Run the Spring Boot application when the container starts
ENTRYPOINT ["java", "-jar", "DATA_PIPLINE-0.0.1-SNAPSHOT.jar"]