-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (25 loc) · 858 Bytes
/
Dockerfile
File metadata and controls
39 lines (25 loc) · 858 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
35
36
37
38
39
# Multi Stage Builds
#------------------------ Stage 1: Building JAR File --------------------
# We use a Maven image that has JDK 21 pre-installed
FROM maven:3.9.6-eclipse-temurin-21 AS build
WORKDIR /build
# 1. Copy only the pom.xml first to cache dependencies
COPY pom.xml .
# 2. Download dependencies (this layer is cached unless pom.xml changes)
RUN mvn dependency:go-offline
# 3. Copy the source code
COPY src ./src
# 4. Build the application
# Added -X and -e as requested for detailed error logging
# 4. Build the application
RUN mvn clean package -DskipTests
#------------------------ Stage 2: Run --------------------
FROM eclipse-temurin:21-jre-alpine
WORKDIR /HighVolumeIngestionService
COPY --from=build /build/target/*.jar app.jar
EXPOSE 8080
EXPOSE 2181
EXPOSE 9092
EXPOSE 5432
EXPOSE 29092
ENTRYPOINT ["java", "-jar", "app.jar"]