-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
34 lines (24 loc) · 1.1 KB
/
Copy pathDockerfile
File metadata and controls
34 lines (24 loc) · 1.1 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
# STAGE 1: Build & Compile (Isolated Build Environment)
FROM eclipse-temurin:21-jdk-alpine AS builder
WORKDIR /build
# Copy dependency files first to leverage Docker layer caching
COPY pom.xml .
RUN apk add --no-cache maven && mvn dependency:go-offline -B
# Copy source code and compile the artifact without running tests
COPY src ./src
RUN mvn clean package -DskipTests -Djava.net.preferIPv4Stack=true
# STAGE 2: Production Runtime (Security Image)
FROM eclipse-temurin:21-jre-alpine AS runtime
WORKDIR /app
# Create a non-root user for security practices
RUN addgroup -S dataguard && adduser -S dataguard -G dataguard
USER dataguard
# Copy only the compiled JAR from the build stage
COPY --from=builder /build/target/java-anonimo-engine-1.0-SNAPSHOT.jar ./dataguard-engine.jar
# Mount points for external data processing and license injection
VOLUME ["/data", "/etc/dataguard"]
# Default JVM performance options (G1GC and RAM limit awareness)
ENV JAVA_OPTS="-XX:+UseG1GC -XX:MaxRAMPercentage=75.0"
# Immutable entrypoint
ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -jar dataguard-engine.jar $0 $@"]
CMD ["--help"]