-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
34 lines (24 loc) · 702 Bytes
/
Dockerfile
File metadata and controls
34 lines (24 loc) · 702 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
# --- Stage 1: Build the application ---
FROM gradle:8.5-jdk17 AS builder
# Create app directory
WORKDIR /app
# Copy Gradle wrapper files (for caching)
COPY gradle gradle
COPY gradlew .
COPY build.gradle settings.gradle ./
# Pre-download dependencies
RUN ./gradlew dependencies --no-daemon
# Copy source files
COPY src ./src
# Build the application
RUN ./gradlew bootJar --no-daemon
# --- Stage 2: Run the application ---
FROM eclipse-temurin:17-jre-alpine
# Create app directory
WORKDIR /app
# Copy built jar from previous stage
COPY --from=builder /app/build/libs/*.jar app.jar
# Expose application port (e.g., 8080)
EXPOSE 8080
# Run the application
ENTRYPOINT ["java", "-jar", "app.jar"]