Skip to content

Commit e91cfaa

Browse files
committed
Update and improve Dockerfile
* Proper file permissions - Execute bit only for scripts - No write bits for anyone * Replace curl HEALTHCHECK with java client * Update java version
1 parent 92b7e5a commit e91cfaa

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

Dockerfile

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,26 @@ COPY ./src /build/src
1414
COPY ./profiles/prod /build/profiles/prod
1515
RUN mvn -Pprod -DskipTests=true clean package spring-boot:repackage
1616

17-
FROM eclipse-temurin:25.0.1_8-jre
17+
FROM eclipse-temurin:25.0.2_10-jre
1818

1919
# Application Insights version
2020
ARG APPINSIGHTS_VERSION=3.7.7
2121

22-
RUN apt-get update && apt-get install -y curl
23-
2422
# expose server port
2523
EXPOSE 8080
2624

27-
# download script for reading Docker secrets
28-
ADD --chmod=755 https://raw.githubusercontent.com/HSLdevcom/jore4-tools/main/docker/read-secrets.sh /tmp/read-secrets.sh
25+
ADD --chmod=555 https://raw.githubusercontent.com/HSLdevcom/jore4-tools/main/docker/read-secrets.sh /tmp/read-secrets.sh
26+
27+
# Downaload a Java applet to perform HEALTHCHECK with
28+
ADD --chmod=444 https://raw.githubusercontent.com/HSLdevcom/jore4-tools/main/docker/HealthCheck.jar /app/scripts/HealthCheck.jar
2929

3030
# Connection string is provided as env in Kubernetes by secrets manager
3131
# 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
32+
ADD --chmod=444 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=444 ./applicationinsights.json /usr/src/jore4-timetables/applicationinsights.json
3434

35-
# copy over helper scripts
36-
COPY --chmod=755 ./script/build-jdbc-urls.sh /tmp/
35+
# add helper script for constructing JDBC URL
36+
COPY --chmod=555 ./script/build-jdbc-urls.sh /tmp/build-jdbc-urls.sh
3737

3838
# copy compiled jar from builder stage
3939
COPY --from=builder /build/target/*.jar /usr/src/jore4-timetables/jore4-timetables.jar
@@ -42,4 +42,4 @@ COPY --from=builder /build/target/*.jar /usr/src/jore4-timetables/jore4-timetabl
4242
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"]
4343

4444
HEALTHCHECK --interval=1m --timeout=5s \
45-
CMD curl --fail http://localhost:8080/actuator/health
45+
CMD ["java", "-jar", "/app/scripts/HealthCheck.jar"]

0 commit comments

Comments
 (0)