-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
79 lines (60 loc) · 2.62 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
FROM eclipse-temurin:21 AS app-builder
ENV DEBIAN_FRONTEND=noninteractive
RUN mkdir -p /opt/build
WORKDIR /opt/build
RUN apt-get update && \
apt-get install -y maven && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
FROM app-builder AS app-deps
COPY pom.xml .
COPY modules/parent/pom.xml modules/parent/
COPY modules/common/pom.xml modules/common/
COPY modules/lib/pom.xml modules/lib/
COPY modules/parsers/pom.xml modules/parsers/
COPY modules/tftp/pom.xml modules/tftp/
COPY modules/client/pom.xml modules/client/
COPY modules/mysensors/pom.xml modules/mysensors/
COPY modules/vclu/pom.xml modules/vclu/
COPY assembly/jar-with-dependencies.xml assembly/
# https://issues.apache.org/jira/browse/MDEP-689
#RUN mvn -B -T 4 dependency:go-offline
RUN mvn -B -T 4 -pl '!modules/client,!modules/mysensors' compile -Dorg.slf4j.simpleLogger.defaultLogLevel=ERROR -Dmaven.test.skip=true -Dmaven.site.skip=true -Dmaven.source.skip=true -Dmaven.javadoc.skip=true
FROM app-deps AS app-build
COPY modules/tftp modules/tftp
COPY modules/common modules/common
COPY modules/lib modules/lib
COPY modules/parsers modules/parsers
COPY modules/vclu modules/vclu
COPY .git .git
RUN mvn -B -T 4 -pl '!modules/client' clean package -Dorg.slf4j.simpleLogger.defaultLogLevel=WARN -Dmaven.test.skip=true -Dmaven.site.skip=true -Dmaven.source.skip=true -Dmaven.javadoc.skip=true
FROM eclipse-temurin:21-alpine AS jre-build
RUN mkdir -p /opt/build
WORKDIR /opt/build
#COPY --from=app-build /opt/build/vclu/target/vclu.jar .
RUN $JAVA_HOME/bin/jlink \
--add-modules java.base,java.net.http,java.xml,java.naming,java.management,jdk.zipfs,jdk.crypto.ec,jdk.httpserver \
# --add-modules $(jdeps --ignore-missing-deps --print-module-deps vclu.jar),java.base,java.xml,java.naming,java.management,java.sql,java.instrument,jdk.zipfs \
--strip-debug \
--no-man-pages \
--no-header-files \
--compress=2 \
--output /opt/build/jre
FROM alpine:3.19 AS app-runtime
ENV JAVA_HOME=/opt/java/openjdk
ENV PATH "${JAVA_HOME}/bin:${PATH}"
RUN mkdir -p /opt/docker/runtime
WORKDIR /opt/docker
COPY --from=jre-build /opt/build/jre $JAVA_HOME
COPY --from=app-build /opt/build/modules/vclu/target/vclu-jar-with-dependencies.jar /opt/docker/vclu.jar
#COPY runtime .
ENTRYPOINT [ \
"java", \
"-XX:+DisableAttachMechanism", \
"-server", "-Xshare:off", "-XX:+UseContainerSupport", "-XX:+UseZGC", "-XX:+UseDynamicNumberOfGCThreads", \
"-XX:+ExitOnOutOfMemoryError", \
"-Djava.net.preferIPv6Addresses=false", \
# "-Djava.net.preferIPv4Stack=true", \
"-Djava.awt.headless=true", "-Dfile.encoding=UTF-8", \
"-jar", "vclu.jar" \
]