-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
29 lines (21 loc) · 814 Bytes
/
Dockerfile
File metadata and controls
29 lines (21 loc) · 814 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
FROM eclipse-temurin:24-jdk AS build
WORKDIR /app
# Copy build tooling first to leverage layer caching during dependency resolution
COPY .mvn/ .mvn/
COPY mvnw pom.xml ./
# Pre-fetch dependencies to speed up subsequent builds
RUN ./mvnw -B -ntp dependency:go-offline
# Bring in the full project and build the Spring Boot fat jar
COPY . .
RUN ./mvnw -B -DskipTests clean package \
&& JAR_FILE="$(find target -maxdepth 1 -type f -name '*.jar' ! -name '*original*' | head -n 1)" \
&& test -n "$JAR_FILE" \
&& cp "$JAR_FILE" app.jar
FROM eclipse-temurin:24-jre AS runtime
WORKDIR /app
# Run as a non-root user for better container hardening
RUN useradd --system --create-home --home-dir /app ezclaim
COPY --from=build /app/app.jar ./app.jar
EXPOSE 8080
USER ezclaim
ENTRYPOINT ["java","-jar","/app/app.jar"]