@@ -16,6 +16,9 @@ RUN mvn -Pprod -DskipTests=true clean package spring-boot:repackage
1616
1717FROM eclipse-temurin:25.0.1_8-jre
1818
19+ # Application Insights version
20+ ARG APPINSIGHTS_VERSION=3.7.7
21+
1922RUN apt-get update && apt-get install -y curl
2023
2124# expose server port
@@ -24,14 +27,19 @@ EXPOSE 8080
2427# download script for reading Docker secrets
2528ADD --chmod=755 https://raw.githubusercontent.com/HSLdevcom/jore4-tools/main/docker/read-secrets.sh /tmp/read-secrets.sh
2629
30+ # Connection string is provided as env in Kubernetes by secrets manager
31+ # it should not be provided for other environments (local etc)
32+ ADD --chmod=755 https://github.com/microsoft/ApplicationInsights-Java/releases/download/${APPINSIGHTS_VERSION}/applicationinsights-agent-${APPINSIGHTS_VERSION}.jar /usr/src/jore4-timetables/applicationinsights-agent.jar
33+ COPY --chmod=755 ./applicationinsights.json /usr/src/jore4-timetables/applicationinsights.json
34+
2735# copy over helper scripts
2836COPY --chmod=755 ./script/build-jdbc-urls.sh /tmp/
2937
3038# copy compiled jar from builder stage
3139COPY --from=builder /build/target/*.jar /usr/src/jore4-timetables/jore4-timetables.jar
3240
3341# read Docker secrets into environment variables and run application
34- CMD ["/bin/bash" , "-c" , "source /tmp/read-secrets.sh && source /tmp/build-jdbc-urls.sh && java -jar /usr/src/jore4-timetables/jore4-timetables.jar" ]
42+ CMD ["/bin/bash" , "-c" , "source /tmp/read-secrets.sh && source /tmp/build-jdbc-urls.sh && java -javaagent:/usr/src/jore4-timetables/applicationinsights-agent.jar - jar /usr/src/jore4-timetables/jore4-timetables.jar" ]
3543
3644HEALTHCHECK --interval=1m --timeout=5s \
3745 CMD curl --fail http://localhost:8080/actuator/health
0 commit comments