-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile
45 lines (36 loc) · 1.26 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
36
37
38
39
40
41
42
43
44
45
# syntax=docker/dockerfile:1
FROM eclipse-temurin:21.0.2_13-jdk-alpine AS jre-build
RUN apk update; \
apk upgrade
# add the jar file
COPY fhir-validator.jar ./fhir-validator.jar
# extract it
RUN jar xf fhir-validator.jar
# use jdeps to get all the dependencies so we can have a custom runtime
RUN jdeps --ignore-missing-deps -q \
--recursive \
--multi-release 21 \
--print-module-deps \
--class-path 'BOOT-INF/lib/*' \
fhir-validator.jar > deps.info
# Create a custom Java runtime using the dependency list we created above
RUN jlink \
--add-modules $(cat deps.info) \
--strip-debug \
--compress 2 \
--no-header-files \
--no-man-pages \
--output /javaruntime
# now actually create the runtime image we want
FROM alpine:3.19.1 AS runtime
RUN apk update; \
apk upgrade
ENV JAVA_HOME=/opt/java/openjdk
ENV PATH="${JAVA_HOME}/bin:${PATH}"
COPY --from=jre-build /javaruntime $JAVA_HOME
WORKDIR /app
COPY fhir-validator.jar ./fhir-validator.jar
RUN chmod -R a+x /app
USER nobody
#AEA-1024: Setting TEST_SYSTEM_PROP_VALIDATION_RESOURCE_CACHES_MS to max long so our resource cache never expires.
CMD ["java", "-Xms3000m", "-Xmx3000m", "-DTEST_SYSTEM_PROP_VALIDATION_RESOURCE_CACHES_MS=9223372036854775807", "-jar", "fhir-validator.jar"]