This is an automated email from the ASF dual-hosted git repository. xiangfu pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/pinot.git
The following commit(s) were added to refs/heads/master by this push: new 661a7d6a5d Adding pinot base docker image to reduce build time (#9229) 661a7d6a5d is described below commit 661a7d6a5d482e98987317a94fd12796b47d82c4 Author: Xiang Fu <xiangfu.1...@gmail.com> AuthorDate: Wed Aug 17 00:00:23 2022 -0700 Adding pinot base docker image to reduce build time (#9229) --- docker/images/pinot-base/README.md | 59 ++++++++++++++++++++++ .../images/pinot-base/pinot-base-build/Dockerfile | 48 ++++++++++++++++++ .../pinot-base/pinot-base-runtime/Dockerfile | 39 ++++++++++++++ docker/images/pinot/Dockerfile | 41 ++------------- 4 files changed, 149 insertions(+), 38 deletions(-) diff --git a/docker/images/pinot-base/README.md b/docker/images/pinot-base/README.md new file mode 100644 index 0000000000..d7f5e92917 --- /dev/null +++ b/docker/images/pinot-base/README.md @@ -0,0 +1,59 @@ +<!-- + + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +--> + +# docker-pinot-base +This is the base docker image to build [Apache Pinot](https://github.com/apache/pinot). + +## How to build a docker image + +Arguments: + +`JAVA_VERSION`: The Java Build and Runtime image version. Default is `11` + +`OPENJDK_IMAGE`: Base image to use for Pinot build and runtime, e.g. `arm64v8/openjdk`. Default is `openjdk`. + +Usage: +```SHELL +docker build -t apachepinot/pinot-base-build:openjdk11 --no-cache --network=host --build-arg JAVA_VERSION=11 -f pinot-base-build/Dockerfile . +``` + +```SHELL +docker build -t apachepinot/pinot-base-runtime:openjdk11 --no-cache --network=host --build-arg JAVA_VERSION=11 -f pinot-base-runtime/Dockerfile . +``` + +Note that if you are not on arm64 machine, you can still build the image by turning on the experimental feature of docker, and add `--platform linux/arm64` into the `docker build ...` script, e.g. +```SHELL +docker build -t apachepinot/pinot-base-build:openjdk11-arm64v8 --platform linux/arm64 --no-cache --network=host --build-arg JAVA_VERSION=11 --build-arg OPENJDK_IMAGE=arm64v8/openjdk -f pinot-base-build/Dockerfile . +``` +```SHELL +docker build -t apachepinot/pinot-base-runtime:openjdk11-arm64v8 --platform linux/arm64 --no-cache --network=host --build-arg JAVA_VERSION=11 --build-arg OPENJDK_IMAGE=arm64v8/openjdk -f pinot-base-runtime/Dockerfile . +``` + +## Publish the docker image + +Here is the [Github Action task](https://github.com/apachepinot/pinot-fork/actions/workflows/build-pinot-docker-base-image.yml) to build and publish pinot base docker images. + +This task can be triggered manually to build the cross platform(amd64 and arm64v8) base image. + +The build shell is: +```SHELL +docker buildx build --no-cache --platform=linux/arm64,linux/amd64 --file Dockerfile --tag apachepinot/pinot-base-build:openjdk11 --push . +``` \ No newline at end of file diff --git a/docker/images/pinot-base/pinot-base-build/Dockerfile b/docker/images/pinot-base/pinot-base-build/Dockerfile new file mode 100644 index 0000000000..5b93684c56 --- /dev/null +++ b/docker/images/pinot-base/pinot-base-build/Dockerfile @@ -0,0 +1,48 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +ARG JAVA_VERSION=11 +ARG OPENJDK_IMAGE=openjdk +FROM ${OPENJDK_IMAGE}:${JAVA_VERSION} AS pinot_build_env + +LABEL MAINTAINER=d...@pinot.apache.org + +# extra dependency for running launcher +RUN apt-get update && \ + apt-get install -y --no-install-recommends vim wget curl git automake bison flex g++ libboost-all-dev libevent-dev \ + libssl-dev libtool make pkg-config && \ + rm -rf /var/lib/apt/lists/* + +# install maven +RUN mkdir -p /usr/share/maven /usr/share/maven/ref \ + && wget https://downloads.apache.org/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz -P /tmp \ + && tar -xzf /tmp/apache-maven-*.tar.gz -C /usr/share/maven --strip-components=1 \ + && rm -f /tmp/apache-maven-*.tar.gz \ + && ln -s /usr/share/maven/bin/mvn /usr/bin/mvn +ENV MAVEN_HOME /usr/share/maven +ENV MAVEN_CONFIG /opt/.m2 + +# install thrift +RUN wget http://archive.apache.org/dist/thrift/0.12.0/thrift-0.12.0.tar.gz -O /tmp/thrift-0.12.0.tar.gz && \ + tar xfz /tmp/thrift-0.12.0.tar.gz --directory /tmp && \ + base_dir=`pwd` && \ + cd /tmp/thrift-0.12.0 && \ + ./configure --with-cpp=no --with-c_glib=no --with-java=yes --with-python=no --with-ruby=no --with-erlang=no --with-go=no --with-nodejs=no --with-php=no && \ + make install + +CMD ["-help"] diff --git a/docker/images/pinot-base/pinot-base-runtime/Dockerfile b/docker/images/pinot-base/pinot-base-runtime/Dockerfile new file mode 100644 index 0000000000..7a8ade3016 --- /dev/null +++ b/docker/images/pinot-base/pinot-base-runtime/Dockerfile @@ -0,0 +1,39 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +ARG JAVA_VERSION=11 +ARG OPENJDK_IMAGE=openjdk + +FROM ${OPENJDK_IMAGE}:${JAVA_VERSION}-jdk-slim + +LABEL MAINTAINER=d...@pinot.apache.org + +RUN apt-get update && \ + apt-get install -y --no-install-recommends vim less wget curl git python sysstat procps linux-perf openjdk-11-dbg && \ + rm -rf /var/lib/apt/lists/* + +RUN case `uname -m` in \ + x86_64) arch=x64; ;; \ + aarch64) arch=arm64; ;; \ + *) echo "platform=$(uname -m) un-supported, exit ..."; exit 1; ;; \ + esac \ + && mkdir -p /usr/local/lib/async-profiler \ + && curl -L https://github.com/jvm-profiling-tools/async-profiler/releases/download/v2.5.1/async-profiler-2.5.1-linux-${arch}.tar.gz | tar -xz --strip-components 1 -C /usr/local/lib/async-profiler \ + && ln -s /usr/local/lib/async-profiler/profiler.sh /usr/local/bin/async-profiler + +CMD ["bash"] diff --git a/docker/images/pinot/Dockerfile b/docker/images/pinot/Dockerfile index 9a1fac9c41..499060ed7c 100644 --- a/docker/images/pinot/Dockerfile +++ b/docker/images/pinot/Dockerfile @@ -16,9 +16,8 @@ # specific language governing permissions and limitations # under the License. # -ARG JAVA_VERSION=11 -ARG OPENJDK_IMAGE=openjdk -FROM ${OPENJDK_IMAGE}:${JAVA_VERSION} AS pinot_build_env +ARG PINOT_BASE_IMAGE_TAG=openjdk11 +FROM apachepinot/pinot-base-build:${PINOT_BASE_IMAGE_TAG} AS pinot_build_env LABEL MAINTAINER=d...@pinot.apache.org @@ -29,30 +28,9 @@ ARG PINOT_GIT_URL="https://github.com/apache/pinot.git" RUN echo "Trying to build Pinot from [ ${PINOT_GIT_URL} ] on branch [ ${PINOT_BRANCH} ] with Kafka version [ ${KAFKA_VERSION} ]" ENV PINOT_HOME=/opt/pinot ENV PINOT_BUILD_DIR=/opt/pinot-build - -# extra dependency for running launcher -RUN apt-get update && \ - apt-get install -y --no-install-recommends vim wget curl git automake bison flex g++ libboost-all-dev libevent-dev \ - libssl-dev libtool make pkg-config && \ - rm -rf /var/lib/apt/lists/* - -# install maven -RUN mkdir -p /usr/share/maven /usr/share/maven/ref \ - && wget https://downloads.apache.org/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz -P /tmp \ - && tar -xzf /tmp/apache-maven-*.tar.gz -C /usr/share/maven --strip-components=1 \ - && rm -f /tmp/apache-maven-*.tar.gz \ - && ln -s /usr/share/maven/bin/mvn /usr/bin/mvn ENV MAVEN_HOME /usr/share/maven ENV MAVEN_CONFIG /opt/.m2 -# install thrift -RUN wget http://archive.apache.org/dist/thrift/0.12.0/thrift-0.12.0.tar.gz -O /tmp/thrift-0.12.0.tar.gz && \ - tar xfz /tmp/thrift-0.12.0.tar.gz --directory /tmp && \ - base_dir=`pwd` && \ - cd /tmp/thrift-0.12.0 && \ - ./configure --with-cpp=no --with-c_glib=no --with-java=yes --with-python=no --with-ruby=no --with-erlang=no --with-go=no --with-nodejs=no --with-php=no && \ - make install - RUN git clone ${PINOT_GIT_URL} ${PINOT_BUILD_DIR} && \ cd ${PINOT_BUILD_DIR} && \ git checkout ${PINOT_BRANCH} && \ @@ -62,7 +40,7 @@ RUN git clone ${PINOT_GIT_URL} ${PINOT_BUILD_DIR} && \ cp -r build/* ${PINOT_HOME}/. && \ chmod +x ${PINOT_HOME}/bin/*.sh -FROM ${OPENJDK_IMAGE}:${JAVA_VERSION}-jdk-slim +FROM apachepinot/pinot-base-runtime:${PINOT_BASE_IMAGE_TAG} LABEL MAINTAINER=d...@pinot.apache.org @@ -71,19 +49,6 @@ ENV JAVA_OPTS="-Xms4G -Xmx4G -Dpinot.admin.system.exit=false" VOLUME ["${PINOT_HOME}/configs", "${PINOT_HOME}/data"] -RUN apt-get update && \ - apt-get install -y --no-install-recommends vim less wget curl git python sysstat procps linux-perf openjdk-11-dbg && \ - rm -rf /var/lib/apt/lists/* - -RUN case `uname -m` in \ - x86_64) arch=x64; ;; \ - aarch64) arch=arm64; ;; \ - *) echo "platform=$(uname -m) un-supported, exit ..."; exit 1; ;; \ - esac \ - && mkdir -p /usr/local/lib/async-profiler \ - && curl -L https://github.com/jvm-profiling-tools/async-profiler/releases/download/v2.5.1/async-profiler-2.5.1-linux-${arch}.tar.gz | tar -xz --strip-components 1 -C /usr/local/lib/async-profiler \ - && ln -s /usr/local/lib/async-profiler/profiler.sh /usr/local/bin/async-profiler - COPY --from=pinot_build_env ${PINOT_HOME} ${PINOT_HOME} COPY bin ${PINOT_HOME}/bin COPY etc ${PINOT_HOME}/etc --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org