Skip to content

Commit 123316b

Browse files
authored
1 parent 243b085 commit 123316b

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

docker/Dockerfile

+17-5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,20 @@
1717
# under the License.
1818
#
1919

20+
FROM eclipse-temurin:17 as jre-build
21+
22+
# Create a custom Java runtime
23+
RUN $JAVA_HOME/bin/jlink \
24+
--add-modules ALL-MODULE-PATH \
25+
--strip-debug \
26+
--no-man-pages \
27+
--no-header-files \
28+
--compress=2 \
29+
--output /javaruntime
30+
31+
RUN echo networkaddress.cache.ttl=1 >> /javaruntime/conf/security/java.security
32+
RUN echo networkaddress.cache.negative.ttl=1 >> /javaruntime/conf/security/java.security
33+
2034
FROM ubuntu:22.04
2135
MAINTAINER Apache BookKeeper <[email protected]>
2236

@@ -42,7 +56,6 @@ RUN set -x \
4256
&& adduser "${BK_USER}" \
4357
&& apt-get update \
4458
&& apt-get install -y ca-certificates apt-transport-https \
45-
&& apt-get install -y --no-install-recommends openjdk-17-jdk \
4659
&& apt-get install -y --no-install-recommends python3 pip \
4760
&& ln -s /usr/bin/python3 /usr/bin/python \
4861
&& apt-get install -y --no-install-recommends gpg gpg-agent wget sudo \
@@ -66,10 +79,9 @@ RUN set -x \
6679

6780
WORKDIR /opt/bookkeeper
6881

69-
ENV JAVA_HOME /usr/lib/jvm/java-17-openjdk-$TARGETARCH
70-
71-
RUN echo networkaddress.cache.ttl=1 >> $JAVA_HOME/conf/security/java.security \
72-
&& echo networkaddress.cache.negative.ttl=1 >> $JAVA_HOME/conf/security/java.security
82+
ENV JAVA_HOME=/opt/java/openjdk
83+
ENV PATH="$PATH:$JAVA_HOME/bin"
84+
COPY --from=jre-build /javaruntime $JAVA_HOME
7385

7486
COPY scripts /opt/bookkeeper/scripts
7587
RUN chmod +x -R /opt/bookkeeper/scripts/

0 commit comments

Comments
 (0)