forked from pranay-ramayanapu/formula
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (23 loc) · 633 Bytes
/
Dockerfile
File metadata and controls
31 lines (23 loc) · 633 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
# ---------- Stage 1: Build ----------
FROM eclipse-temurin:21-alpine AS build
WORKDIR /app
# Copy Maven wrapper and project files
COPY .mvn .mvn
COPY mvnw .
COPY pom.xml .
# Give execute permissions to mvnw
RUN chmod +x mvnw
# Download dependencies
RUN ./mvnw dependency:go-offline
# Copy source files
COPY src ./src
# Build the project
RUN ./mvnw clean package -DskipTests
# ---------- Stage 2: Run ----------
FROM eclipse-temurin:21-jre-alpine
WORKDIR /app
# Copy jar from builder stage
COPY --from=build /app/target/formula-0.0.1-SNAPSHOT.jar app.jar
# Use dynamic port
EXPOSE 5002
ENTRYPOINT ["java", "-jar", "app.jar"]