HBASE-27459 Improve our hbase_docker to be able to build and start standalone clusters other than master branch (#4861)

Signed-off-by: Yulin Niu <niuyulin@apache.org>
This commit is contained in:
Duo Zhang 2022-12-13 23:59:27 +08:00 committed by GitHub
parent 37c82a6209
commit d78d40404c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 19 deletions

View File

@ -14,15 +14,15 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
FROM ubuntu:18.04 AS BASE_IMAGE FROM ubuntu:22.04 AS BASE_IMAGE
SHELL ["/bin/bash", "-o", "pipefail", "-c"] SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN DEBIAN_FRONTEND=noninteractive apt-get -qq update && \ RUN DEBIAN_FRONTEND=noninteractive apt-get -qq update && \
DEBIAN_FRONTEND=noninteractive apt-get -qq install --no-install-recommends -y \ DEBIAN_FRONTEND=noninteractive apt-get -qq install --no-install-recommends -y \
ca-certificates=20180409 \ ca-certificates=20211016 \
curl='7.58.0-*' \ curl='7.81.0-*' \
git='1:2.17.1-*' \ git='1:2.34.1-*' \
locales='2.27-*' \ locales='2.35-*' \
&& \ && \
apt-get clean && \ apt-get clean && \
rm -rf /var/lib/apt/lists/* \ rm -rf /var/lib/apt/lists/* \
@ -31,16 +31,16 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get -qq update && \
ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8
FROM BASE_IMAGE AS MAVEN_DOWNLOAD_IMAGE FROM BASE_IMAGE AS MAVEN_DOWNLOAD_IMAGE
ENV MAVEN_VERSION='3.6.3' ENV MAVEN_VERSION='3.8.6'
ENV MAVEN_URL "https://archive.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz" ENV MAVEN_URL "https://archive.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz"
ENV MAVEN_SHA512 'c35a1803a6e70a126e80b2b3ae33eed961f83ed74d18fcd16909b2d44d7dada3203f1ffe726c17ef8dcca2dcaa9fca676987befeadc9b9f759967a8cb77181c0' ENV MAVEN_SHA512 'f790857f3b1f90ae8d16281f902c689e4f136ebe584aba45e4b1fa66c80cba826d3e0e52fdd04ed44b4c66f6d3fe3584a057c26dfcac544a60b301e6d0f91c26'
SHELL ["/bin/bash", "-o", "pipefail", "-c"] SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN curl --location --fail --silent --show-error --output /tmp/maven.tar.gz "${MAVEN_URL}" && \ RUN curl --location --fail --silent --show-error --output /tmp/maven.tar.gz "${MAVEN_URL}" && \
echo "${MAVEN_SHA512} */tmp/maven.tar.gz" | sha512sum -c - echo "${MAVEN_SHA512} */tmp/maven.tar.gz" | sha512sum -c -
FROM BASE_IMAGE AS OPENJDK8_DOWNLOAD_IMAGE FROM BASE_IMAGE AS OPENJDK8_DOWNLOAD_IMAGE
ENV OPENJDK8_URL 'https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u345-b01/OpenJDK8U-jdk_x64_linux_hotspot_8u345b01.tar.gz' ENV OPENJDK8_URL 'https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u352-b08/OpenJDK8U-jdk_x64_linux_hotspot_8u352b08.tar.gz'
ENV OPENJDK8_SHA256 'ed6c9db3719895584fb1fd69fc79c29240977675f26631911c5a1dbce07b7d58' ENV OPENJDK8_SHA256 '1633bd7590cb1cd72f5a1378ae8294451028b274d798e2a4ac672059a2f00fee'
SHELL ["/bin/bash", "-o", "pipefail", "-c"] SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN curl --location --fail --silent --show-error --output /tmp/adoptopenjdk8.tar.gz "${OPENJDK8_URL}" && \ RUN curl --location --fail --silent --show-error --output /tmp/adoptopenjdk8.tar.gz "${OPENJDK8_URL}" && \
echo "${OPENJDK8_SHA256} */tmp/adoptopenjdk8.tar.gz" | sha256sum -c - echo "${OPENJDK8_SHA256} */tmp/adoptopenjdk8.tar.gz" | sha256sum -c -
@ -74,9 +74,10 @@ ENV PATH "${JAVA_HOME}/bin:${MAVEN_HOME}/bin:${PATH}"
# Pull down HBase and build it into /root/hbase-bin. # Pull down HBase and build it into /root/hbase-bin.
WORKDIR /root WORKDIR /root
RUN git clone https://gitbox.apache.org/repos/asf/hbase.git -b master \ ARG BRANCH_OR_TAG=master
RUN git clone --depth 1 -b ${BRANCH_OR_TAG} https://github.com/apache/hbase.git \
&& \ && \
mvn clean install -DskipTests assembly:single -f ./hbase/pom.xml \ mvn -T1C clean install -DskipTests assembly:single -f ./hbase/pom.xml \
&& \ && \
mkdir -p hbase-bin \ mkdir -p hbase-bin \
&& \ && \

View File

@ -22,20 +22,20 @@ under the License.
## Overview ## Overview
The Dockerfile in this folder can be used to build a Docker image running The Dockerfile in this folder can be used to build a Docker image running
the latest HBase master branch in standalone mode. It does this by setting a specific HBase branch or tag(default to master) in standalone mode. It
up necessary dependencies, checking out the master branch of HBase from does this by setting up necessary dependencies, checking out the specific
GitHub, and then building HBase. By default, this image will start the HMaster branch or tag of HBase from GitHub, and then building HBase. By default,
and launch the HBase shell when run. this image will start the HMaster and launch the HBase shell when run.
## Usage ## Usage
1. Ensure that you have a recent version of Docker installed from 1. Ensure that you have a recent version of Docker installed from
[docker.io](http://www.docker.io). [docker.io](http://www.docker.io).
1. Set this folder as your working directory. 1. Set this folder as your working directory.
1. Type `docker build -t hbase_docker .` to build a Docker image called **hbase_docker**. 1. Type `docker build -t hbase_docker --build-arg BRANCH_OR_TAG=<branch or tag>.`
This may take 10 minutes or more the first time you run the command since it will to build a Docker image called **hbase_docker**. This may take 10 minutes
create a Maven repository inside the image as well as checkout the master branch or more the first time you run the command since it will create a Maven
of HBase. repository inside the image as well as checkout the master branch of HBase.
1. When this completes successfully, you can run `docker run -it hbase_docker` 1. When this completes successfully, you can run `docker run -it hbase_docker`
to access an HBase shell running inside of a container created from the to access an HBase shell running inside of a container created from the
**hbase_docker** image. Alternatively, you can type `docker run -it hbase_docker **hbase_docker** image. Alternatively, you can type `docker run -it hbase_docker