File size: 554 Bytes
9373c61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# GraalVM Native Image - Ultra-fast startup, tiny size
# Expected size: ~50-80MB, startup <100ms
# Note: Requires native compilation support in Spring Boot

# Stage 1: Native compilation
FROM ghcr.io/graalvm/graalvm-ce:ol9-java21 as native-builder
WORKDIR /app

# Install native-image
RUN gu install native-image

# Copy source and build native executable
COPY . .
RUN ./gradlew nativeCompile

# Stage 2: Minimal runtime
FROM scratch
COPY --from=native-builder /app/build/native/nativeCompile/app /app
EXPOSE 8080
ENTRYPOINT ["/app"]