-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathDockerfile.native
More file actions
33 lines (24 loc) · 902 Bytes
/
Dockerfile.native
File metadata and controls
33 lines (24 loc) · 902 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
30
31
32
33
# Stage 1: Build the native image
FROM ghcr.io/graalvm/native-image-community:25 AS builder
# Install Maven and Git
RUN microdnf install -y maven git && microdnf clean all
# Set working directory inside the container
WORKDIR /app
# Copy the project files
COPY . .
# Build the native image using Maven
RUN mvn clean package -Pnative -DskipTests
# Stage 2: Create minimal runtime image
FROM debian:bookworm-slim AS runtime
# Install minimal dependencies for native image
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libstdc++6 \
zlib1g && \
rm -rf /var/lib/apt/lists/*
# Set working directory inside the container
WORKDIR /app
# Copy the native executable from the build stage
COPY --from=builder /app/target/opc-ua-demo-server opc-ua-demo-server
# Define the entry point to run server
ENTRYPOINT ["./opc-ua-demo-server"]