Skip to content

Commit 14c91f5

Browse files
Yong Sheng Tanystxn
authored andcommitted
Optimised docker image
1 parent 6660e0b commit 14c91f5

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

Dockerfile

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,27 @@
1-
FROM ghcr.io/graalvm/jdk:21.3
1+
FROM amazoncorretto:17
2+
WORKDIR /build
3+
COPY ./target/*.jar /app/app.jar
4+
RUN cd /app && jar -xf app.jar && \
5+
jdeps \
6+
--ignore-missing-deps \
7+
--print-module-deps \
8+
-q \
9+
--recursive \
10+
--multi-release 17 \
11+
--class-path="BOOT-INF/lib/*" \
12+
--module-path="BOOT-INF/lib/*" \
13+
app.jar > /deps
14+
RUN jlink \
15+
--verbose \
16+
--add-modules $(cat /deps),jdk.naming.dns,jdk.crypto.ec \
17+
--strip-java-debug-attributes \
18+
--no-man-pages \
19+
--no-header-files \
20+
--compress=2 \
21+
--output /jre
22+
23+
FROM gcr.io/distroless/java-base-debian11
24+
COPY --from=0 /jre /jre
225
WORKDIR /data/symphony
326
COPY ./target/*.jar app.jar
4-
RUN useradd symphony && chmod -R 755 /data/symphony
5-
USER symphony
6-
ENTRYPOINT [ "java", "-jar", "./app.jar", "--spring.profiles.active=prod" ]
27+
ENTRYPOINT [ "/jre/bin/java", "-jar", "./app.jar", "--spring.profiles.active=prod" ]

0 commit comments

Comments
 (0)