-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
29 lines (22 loc) · 933 Bytes
/
Dockerfile
File metadata and controls
29 lines (22 loc) · 933 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
# -------- Stage 1: Build the application --------
FROM gradle:9.2.1-jdk25 AS builder
COPY --chown=gradle:gradle . /app
WORKDIR /app
# Build the application (fat JAR)
RUN gradle build -x test --no-daemon
# -------- Stage 2: Create a minimal runtime image --------
FROM eclipse-temurin:25-jre
WORKDIR /app
# Download OpenTelemetry Java Agent
RUN apt-get update && apt-get install -y wget && \
wget https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v2.22.0/opentelemetry-javaagent.jar \
-O /app/opentelemetry-javaagent.jar && \
apt-get remove -y wget && \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/*
# Copy the fat jar from the build stage
COPY --from=builder /app/build/libs/demo-0.0.1-SNAPSHOT.jar /app/app.jar
# Expose port if needed
EXPOSE 8080
# Run the app with Java Agent
ENTRYPOINT ["java", "-javaagent:/app/opentelemetry-javaagent.jar", "-jar", "/app/app.jar"]