File tree Expand file tree Collapse file tree 3 files changed +71
-16
lines changed
Expand file tree Collapse file tree 3 files changed +71
-16
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ RUN addgroup spring && useradd -g spring spring
44USER spring:spring
55
66# https://github.com/microsoft/ApplicationInsights-Java/releases
7- ADD --chown=spring:spring https://github.com/microsoft/ApplicationInsights-Java/releases/download/3.4.19 /applicationinsights-agent-3.4.19 .jar /applicationinsights-agent.jar
7+ ADD --chown=spring:spring https://github.com/microsoft/ApplicationInsights-Java/releases/download/3.6.0 /applicationinsights-agent-3.6.0 .jar /applicationinsights-agent.jar
88
99COPY --chown=spring:spring docker/applicationinsights.json ./applicationinsights.json
1010
Original file line number Diff line number Diff line change 11# docker-base-template based on Java 17
2+ This image is based on ` eclipse-temurin:17-jre ` with applicationinsights agent v3.6.0.
3+
4+ It is useful to run a SpringBoot application v2/v3.
5+
6+ ## How to use
7+ ``` Dockerfile
8+ #
9+ # Build
10+ #
11+ FROM maven:3.9.3-amazoncorretto-17@sha256:4ab7db7bd5f95e58b0ba1346ff29d6abdd9b73e5fd89c5140edead8b037386ff AS buildtime
12+ WORKDIR /build
13+ COPY . .
14+ RUN mvn clean package -Dmaven.test.skip=true
15+
16+ #
17+ # Package stage
18+ #
19+ FROM --platform=linux/amd64 amazoncorretto:17.0.9-alpine3.18@sha256:df48bf2e183230040890460ddb4359a10aa6c7aad24bd88899482c52053c7e17 as builder
20+ COPY --from=buildtime /build/target/*.jar application.jar
21+ RUN java -Djarmode=layertools -jar application.jar extract
22+
23+ #
24+ # Run
25+ #
26+ FROM ghcr.io/pagopa/docker-base-springboot-openjdk17:v2.1.2@sha256:824a241756a32ac9eeef4585a3a266fb019d2c599337269b0c8b419de4c2df3e
27+
28+ COPY --chown=spring:spring --from=builder dependencies/ ./
29+ COPY --chown=spring:spring --from=builder snapshot-dependencies/ ./
30+
31+ # https://github.com/moby/moby/issues/37965#issuecomment-426853382
32+ RUN true
33+ COPY --chown=spring:spring --from=builder spring-boot-loader/ ./
34+ COPY --chown=spring:spring --from=builder application/ ./
35+ ```
36+
37+
38+ ## Application Insights Agent
39+ The agent uses the configuration ` /docker/applicationinsights.json ` .
40+ By default, the sampling is enabled
41+ - dependency: 5%
42+ - trace: 5%
43+ - exception: 100%
44+ - request: 100%
45+
46+ If you want to customize the agent you can add your file in the ` Dockerimage `
47+
48+ ``` Dockerfile
49+ FROM ghcr.io/pagopa/docker-base-springboot-openjdk17:v2.1.2@sha256:824a241756a32ac9eeef4585a3a266fb019d2c599337269b0c8b419de4c2df3e
50+ COPY --chown=spring:spring your/path/to/applicationinsights.json ./applicationinsights.json
51+ ```
52+
Original file line number Diff line number Diff line change 44 "level" : " INFO"
55 },
66 "sampling" : {
7- "percentage" : 5
8- },
9- "preview" : {
10- "sampling" : {
11- "overrides" : [
12- {
13- "telemetryType" : " exception" ,
14- "percentage" : 100
15- },
16- {
17- "telemetryType" : " request" ,
18- "percentage" : 100
19- }
20- ]
21- }
7+ "percentage" : 5 ,
8+ "overrides" : [
9+ {
10+ "telemetryType" : " dependency" ,
11+ "percentage" : 5
12+ },
13+ {
14+ "telemetryType" : " trace" ,
15+ "percentage" : 5
16+ },
17+ {
18+ "telemetryType" : " exception" ,
19+ "percentage" : 100
20+ },
21+ {
22+ "telemetryType" : " request" ,
23+ "percentage" : 100
24+ }
25+ ]
2226 }
2327}
You can’t perform that action at this time.
0 commit comments