Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[improve][docker] Switch to Temurin JDK #17129

Merged
merged 2 commits into from
Aug 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions build/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,22 @@ RUN mkdir /pulsar

RUN apt-get update && \
apt-get install -y software-properties-common && \
add-apt-repository ppa:openjdk-r/ppa && \
apt-get update && \
apt-get install -y tig g++ cmake libssl-dev libcurl4-openssl-dev \
liblog4cxx-dev google-mock libgtest-dev \
libboost-dev libboost-program-options-dev libboost-system-dev libboost-python-dev \
libxml2-utils wget \
curl doxygen openjdk-17-jdk-headless clang-format \
libxml2-utils wget apt-transport-https \
curl doxygen clang-format \
gnupg2 golang-go zip unzip libzstd-dev libsnappy-dev wireshark-dev

# Install Eclipse Temurin Package
RUN mkdir -p /etc/apt/keyrings \
&& wget -O - https://packages.adoptium.net/artifactory/api/gpg/key/public | tee /etc/apt/keyrings/adoptium.asc \
&& echo "deb [signed-by=/etc/apt/keyrings/adoptium.asc] https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | tee /etc/apt/sources.list.d/adoptium.list \
&& apt-get update \
&& apt-get -y dist-upgrade \
&& apt-get -y install temurin-17-jdk

# Compile and install gtest & gmock
RUN cd /usr/src/googletest && \
cmake . && \
Expand Down
20 changes: 15 additions & 5 deletions docker/pulsar/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,20 @@ RUN sed -i "s|http://archive\.ubuntu\.com/ubuntu/|${UBUNTU_MIRROR:-mirror://mirr
&& echo 'Acquire::http::Timeout "30";\nAcquire::ftp::Timeout "30";\nAcquire::Retries "3";' > /etc/apt/apt.conf.d/99timeout_and_retries \
&& apt-get update \
&& apt-get -y dist-upgrade \
&& apt-get -y install --no-install-recommends openjdk-17-jdk-headless netcat dnsutils less procps iputils-ping \
&& apt-get -y install --no-install-recommends netcat dnsutils less procps iputils-ping \
python3 python3-kazoo python3-pip \
curl ca-certificates \
&& apt-get -y --purge autoremove \
curl ca-certificates wget apt-transport-https

# Install Eclipse Temurin Package
RUN mkdir -p /etc/apt/keyrings \
&& wget -O - https://packages.adoptium.net/artifactory/api/gpg/key/public | tee /etc/apt/keyrings/adoptium.asc \
&& echo "deb [signed-by=/etc/apt/keyrings/adoptium.asc] https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | tee /etc/apt/sources.list.d/adoptium.list \
&& apt-get update \
&& apt-get -y dist-upgrade \
&& apt-get -y install temurin-17-jdk

# Cleanup apt
RUN apt-get -y --purge autoremove \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need to run this in the same command that we run our apt-get installations in order to get the benefit of a smaller docker image? Otherwise, we'll add files in one layer and remove them in another.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Would you like to prepare a patch and show the difference in size?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Included in #17733. You can give it a review :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert as if I perform this command merge, the build will fail with returned a non-zero code: 100.

&& apt-get autoclean \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
Expand All @@ -76,8 +86,8 @@ RUN pip3 install pyyaml==5.4.1
# 4. /pulsar - hadoop writes to this directory
RUN mkdir /pulsar && chmod g+w /pulsar

ENV JAVA_HOME /usr/lib/jvm/java-17-openjdk-amd64
RUN echo networkaddress.cache.ttl=1 >> /usr/lib/jvm/java-17-openjdk-amd64/conf/security/java.security
ENV JAVA_HOME /usr/lib/jvm/temurin-17-jdk-amd64
RUN echo networkaddress.cache.ttl=1 >> /usr/lib/jvm/temurin-17-jdk-amd64/conf/security/java.security
nodece marked this conversation as resolved.
Show resolved Hide resolved
ADD target/python-client/ /pulsar/pulsar-client

ENV PULSAR_ROOT_LOGGER=INFO,CONSOLE
Expand Down
14 changes: 11 additions & 3 deletions tests/docker-images/java-test-image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,18 @@ ARG UBUNTU_MIRROR=mirror://mirrors.ubuntu.com/mirrors.txt
RUN sed -i "s|http://archive\.ubuntu\.com/ubuntu/|${UBUNTU_MIRROR:-mirror://mirrors.ubuntu.com/mirrors.txt}|g" /etc/apt/sources.list \
&& apt-get update \
&& apt-get -y dist-upgrade \
&& apt-get -y install openjdk-17-jdk-headless
&& apt-get -y install wget apt-transport-https

ENV JAVA_HOME /usr/lib/jvm/java-17-openjdk-amd64
RUN echo networkaddress.cache.ttl=1 >> /usr/lib/jvm/java-17-openjdk-amd64/conf/security/java.security
# Install Eclipse Temurin Package
RUN mkdir -p /etc/apt/keyrings \
&& wget -O - https://packages.adoptium.net/artifactory/api/gpg/key/public | tee /etc/apt/keyrings/adoptium.asc \
&& echo "deb [signed-by=/etc/apt/keyrings/adoptium.asc] https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | tee /etc/apt/sources.list.d/adoptium.list \
&& apt-get update \
&& apt-get -y dist-upgrade \
&& apt-get -y install temurin-17-jdk

ENV JAVA_HOME /usr/lib/jvm/temurin-17-jdk-amd64
RUN echo networkaddress.cache.ttl=1 >> /usr/lib/jvm/temurin-17-jdk-amd64/conf/security/java.security

# /pulsar/bin/watch-znode.py requires python3-kazoo
# /pulsar/bin/pulsar-managed-ledger-admin requires python3-protobuf
Expand Down