-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
35 lines (25 loc) · 1.07 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# builder docker image
FROM maven:3-eclipse-temurin-17 AS builder
# set up workdir
WORKDIR /build
# download dependencies
COPY ./pom.xml /build
RUN mvn de.qaware.maven:go-offline-maven-plugin:resolve-dependencies
# build
COPY ./src /build/src
COPY ./profiles/prod /build/profiles/prod
RUN mvn clean package spring-boot:repackage -Pprod
# distributed docker image
FROM eclipse-temurin:17.0.8_7-jre
# expose server port
EXPOSE 8080
# download script for reading docker secrets
RUN curl -o /tmp/read-secrets.sh "https://raw.githubusercontent.com/HSLdevcom/jore4-tools/main/docker/read-secrets.sh"
# copy over helper scripts
COPY ./build-jdbc-urls.sh /tmp/
# copy over compiled jar
COPY --from=builder /build/target/*.jar /usr/src/jore4-jore3-importer/importer.jar
# read docker secrets into environment variables, fetch digiroad data and run application
CMD /bin/bash -c "source /tmp/read-secrets.sh && source /tmp/build-jdbc-urls.sh && java -jar /usr/src/jore4-jore3-importer/importer.jar"
HEALTHCHECK --interval=1m --timeout=5s \
CMD curl --fail http://localhost:8080/actuator/health