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