You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by sh...@apache.org on 2022/09/16 00:49:12 UTC
[bookkeeper] branch master updated: Migrate centos7 to ubuntu 22.10, reduce image size (#3492)
This is an automated email from the ASF dual-hosted git repository.
shoothzj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git
The following commit(s) were added to refs/heads/master by this push:
new d14d696b13 Migrate centos7 to ubuntu 22.10, reduce image size (#3492)
d14d696b13 is described below
commit d14d696b13dcac47880a947f16c3f6c5594814b4
Author: ZhangJian He <sh...@gmail.com>
AuthorDate: Fri Sep 16 08:49:06 2022 +0800
Migrate centos7 to ubuntu 22.10, reduce image size (#3492)
### Changes
- migrate statestore image from centos7 to ubuntu
- use `--no-install-recommends` to reduce image size
- elminate `gcc`、`gcc-c++` in image
Thanks for @lhotari
Co-authored-by: Nicolò Boschi <bo...@gmail.com>
---
docker/Dockerfile | 15 ++++++++-------
tests/docker-images/statestore-image/Dockerfile | 25 +++++++++++++++++--------
2 files changed, 25 insertions(+), 15 deletions(-)
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 3a6c3b2cae..586a2c4695 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -38,12 +38,14 @@ ENV DEBIAN_FRONTEND=noninteractive
RUN set -x \
&& adduser "${BK_USER}" \
&& apt-get update \
- && apt-get install -y openjdk-17-jdk \
- && apt-get install -y python3 pip \
+ && apt-get install -y --no-install-recommends openjdk-17-jdk \
+ && apt-get install -y --no-install-recommends python3 pip \
&& ln -s /usr/bin/python3 /usr/bin/python \
- && apt-get install -y gcc g++ \
- && apt-get install -y wget sudo \
- && apt-get clean all \
+ && apt-get install -y --no-install-recommends gpg gpg-agent wget sudo \
+ && apt-get -y --purge autoremove \
+ && apt-get autoclean \
+ && apt-get clean \
+ && rm -rf /var/lib/apt/lists/*
&& mkdir -pv /opt \
&& cd /opt \
&& wget -q "${DISTRO_URL}" \
@@ -56,8 +58,7 @@ RUN set -x \
&& tar -xzf "$DISTRO_NAME.tar.gz" \
&& mv bookkeeper-server-${BK_VERSION}/ /opt/bookkeeper/ \
&& rm -rf "$DISTRO_NAME.tar.gz" "$DISTRO_NAME.tar.gz.asc" "$DISTRO_NAME.tar.gz.sha512" \
- && pip install zk-shell \
- && ls /usr/lib/jvm
+ && pip install zk-shell
WORKDIR /opt/bookkeeper
diff --git a/tests/docker-images/statestore-image/Dockerfile b/tests/docker-images/statestore-image/Dockerfile
index 961af1e239..7605541188 100644
--- a/tests/docker-images/statestore-image/Dockerfile
+++ b/tests/docker-images/statestore-image/Dockerfile
@@ -17,7 +17,11 @@
# under the License.
#
-FROM centos:7
+FROM ubuntu:22.10
+MAINTAINER Apache BookKeeper <de...@bookkeeper.apache.org>
+
+ARG TARGETARCH
+
#ENV OPTS="$OPTS -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005"
ENV BOOKIE_PORT=3181
ENV BOOKIE_HTTP_PORT=8080
@@ -25,19 +29,24 @@ ENV BOOKIE_GRPC_PORT=4181
EXPOSE ${BOOKIE_PORT} ${BOOKIE_HTTP_PORT} ${BOOKIE_GRPC_PORT}
ENV BK_USER=bookkeeper
ENV BK_HOME=/opt/bookkeeper
-ENV JAVA_HOME=/usr/lib/jvm/java-11
+ENV JAVA_HOME /usr/lib/jvm/java-17-openjdk-$TARGETARCH
+ENV DEBIAN_FRONTEND=noninteractive
RUN set -x \
&& adduser "${BK_USER}" \
- && yum install -y java-11-openjdk-devel wget bash python-pip python-devel sudo netcat gcc gcc-c++ \
- && wget -q https://bootstrap.pypa.io/pip/2.7/get-pip.py \
- && python get-pip.py \
+ && apt-get update \
+ && apt-get install -y --no-install-recommends openjdk-17-jdk \
+ && apt-get install -y --no-install-recommends python3 pip \
+ && ln -s /usr/bin/python3 /usr/bin/python \
+ && apt-get install -y --no-install-recommends gpg gpg-agent wget sudo \
+ && apt-get -y --purge autoremove \
+ && apt-get autoclean \
+ && apt-get clean \
+ && rm -rf /var/lib/apt/lists/*
&& pip install zk-shell \
- && rm -rf get-pip.py \
&& mkdir -pv /opt \
- && cd /opt \
- && yum clean all
+ && cd /opt
WORKDIR /opt/bookkeeper
RUN mkdir /opt/bookkeeper/lib