Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ RUN mvn -Pprod -DskipTests=true clean package spring-boot:repackage

FROM eclipse-temurin:25.0.1_8-jre

# Application Insights version
ARG APPINSIGHTS_VERSION=3.7.7

# expose server port
EXPOSE 8080

Expand All @@ -26,14 +29,19 @@ RUN apt-get update \
# download script for reading Docker secrets
ADD --chmod=755 https://raw.githubusercontent.com/HSLdevcom/jore4-tools/main/docker/read-secrets.sh /tmp/read-secrets.sh

# Connection string is provided as env in Kubernetes by secrets manager
# it should not be provided for other environments (local etc)
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
COPY --chmod=755 ./applicationinsights.json /usr/src/jore4-map-matching/applicationinsights.json

# add helper script for constructing JDBC URL
COPY --chmod=755 ./scripts/build-jdbc-urls.sh /tmp/build-jdbc-urls.sh

# copy compiled jar from builder stage
COPY --from=builder /build/target/*.jar /usr/src/jore4-map-matching/jore4-map-matching.jar

# read Docker secrets into environment variables and run application
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"]
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"]

HEALTHCHECK --interval=1m --timeout=5s \
CMD curl --fail http://localhost:8080/actuator/health
5 changes: 5 additions & 0 deletions applicationinsights.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"role": {
"name": "jore4-map-matching"
}
}