-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
34 lines (32 loc) · 931 Bytes
/
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
FROM openjdk:18-slim-bullseye
WORKDIR /build
COPY ./build/libs/*.jar app.jar
RUN jar -xf app.jar
RUN jdeps \
--ignore-missing-deps \
--print-module-deps \
-q \
--recursive \
--multi-release 17 \
--class-path="BOOT-INF/lib/*" \
--module-path="BOOT-INF/lib/*" \
app.jar > /deps
RUN echo $(cat /deps),jdk.crypto.ec > /deps
RUN mkdir /app && cp -r META-INF /app && cp -r BOOT-INF/classes/* /app
FROM openjdk:17-slim-bullseye
COPY --from=0 /deps /deps
RUN jlink \
--verbose \
--add-modules $(cat /deps) \
--strip-java-debug-attributes \
--no-man-pages \
--no-header-files \
--compress=2 \
--output /jre
FROM debian:bullseye-slim
COPY --from=1 /jre /jre
RUN ln -s /jre/bin/java /bin/java
WORKDIR /app
COPY --from=0 /build/BOOT-INF/lib /lib
COPY --from=0 /app .
ENTRYPOINT [ "java", "-cp", ".:/lib/*", "tech.sledger.investments.Investments", "--spring.profiles.active=prod" ]