Squashed commit of the following:
commit 0d624137c2557c6eeb87020749e4977b821c2b5c Author: Adrien <adrien.cesaro@proton.me> Date: Thu Apr 9 11:55:22 2026 +0200 backend native image setup
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
# ---- Pull Maven from its official image (avoids microdnf under QEMU) ----
|
||||
FROM maven:3.9.9-eclipse-temurin-21 AS maven-dist
|
||||
|
||||
# ---- Build stage: GraalVM 25 + Maven ----
|
||||
ARG TARGETPLATFORM=linux/arm64
|
||||
FROM --platform=$TARGETPLATFORM ghcr.io/graalvm/native-image-community:25 AS build
|
||||
|
||||
# Copy Maven from the official Maven image — no package installation needed
|
||||
COPY --from=maven-dist /usr/share/maven /opt/maven
|
||||
ENV PATH="/opt/maven/bin:$PATH"
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Cache dependency resolution separately from source compilation
|
||||
COPY pom.xml .
|
||||
RUN mvn -Pnative dependency:resolve dependency:resolve-plugins -q
|
||||
|
||||
# Build native executable
|
||||
COPY src ./src
|
||||
RUN mvn -Pnative package -DskipTests
|
||||
|
||||
# ---- Runtime stage: minimal ARM64 distroless ----
|
||||
FROM --platform=$TARGETPLATFORM gcr.io/distroless/base-nossl-debian12
|
||||
COPY --from=build /app/target/ai-teacher-backend /app/ai-teacher-backend
|
||||
EXPOSE 8080
|
||||
ENTRYPOINT ["/app/ai-teacher-backend"]
|
||||
Reference in New Issue
Block a user