-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathDockerfile
More file actions
44 lines (35 loc) · 1.15 KB
/
Dockerfile
File metadata and controls
44 lines (35 loc) · 1.15 KB
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
35
36
37
38
39
40
41
42
43
# syntax=docker/dockerfile:1.5
##########
# Build stage
##########
FROM maven:3.9.9-eclipse-temurin-21 AS build
WORKDIR /src
# Copy only all pom.xml files (auto-discovered), preserving paths
# This keeps dependency resolution cacheable even for large multi-module repos.
RUN --mount=type=bind,src=.,dst=/context,readonly \
mkdir -p /src \
&& cd /context \
&& find . -name pom.xml -print0 \
| tar --null -T - -cf - \
| tar -xf - -C /src
# Pre-fetch dependencies (cache ~/.m2 across builds)
RUN --mount=type=cache,dst=/root/.m2 \
mvn -B -T 1C -DskipTests -e dependency:go-offline
# Copy full sources (generic)
RUN --mount=type=bind,src=.,dst=/context,readonly \
tar -cf - -C /context . \
| tar -xf - -C /src
# Build in parallel
RUN --mount=type=cache,dst=/root/.m2 \
mvn -B -T 1C -DskipTests package \
&& mkdir /src/built-target \
&& tar -xzf distribution/target/*.tar.gz -C /src/built-target
##########
# Runtime stage
##########
FROM eclipse-temurin:21-jre-jammy
ENV JAVA_OPTS="-XX:MaxRAMPercentage=75 -XX:+UseContainerSupport"
WORKDIR /app
COPY --from=build /src/built-target/* /app/
EXPOSE 2443
ENTRYPOINT ["/app/bin/unity-idm-server-start", "-f"]