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 @@ -16,6 +16,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

RUN apt-get update && apt-get install -y curl

# expose server port
Expand All @@ -24,14 +27,19 @@ EXPOSE 8080
# 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-timetables/applicationinsights-agent.jar
COPY --chmod=755 ./applicationinsights.json /usr/src/jore4-timetables/applicationinsights.json

# copy over helper scripts
COPY --chmod=755 ./script/build-jdbc-urls.sh /tmp/

# copy compiled jar from builder stage
COPY --from=builder /build/target/*.jar /usr/src/jore4-timetables/jore4-timetables.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-timetables/jore4-timetables.jar"]
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"]

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-timetables"
}
}
Loading