Skip to content

Commit

Permalink
Build docker image with hops hadoop distribution
Browse files Browse the repository at this point in the history
  • Loading branch information
gibchikafa committed Jun 24, 2024
1 parent 4944d54 commit 0675439
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
9 changes: 5 additions & 4 deletions deploy/kubernetes/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ ARG RSS_VERSION
ARG AUTHOR=unknown
ARG GIT_BRANCH=unknown
ARG GIT_COMMIT=unknown
ARG HADOOP_FILE=hops-$HADOOP_VERSION.tgz

LABEL author=${AUTHOR}
LABEL git-branch=${GIT_BRANCH}
Expand All @@ -44,10 +45,10 @@ COPY rss-env.sh /data/rssadmin/rss/bin

COPY start.sh /data/rssadmin/rss/bin

COPY hadoop-${HADOOP_VERSION}.tar.gz /data/rssadmin
RUN tar -zxvf /data/rssadmin/hadoop-${HADOOP_VERSION}.tar.gz -C /data/rssadmin
RUN mv /data/rssadmin/hadoop-${HADOOP_VERSION} /data/rssadmin/hadoop
RUN rm -rf /data/rssadmin/hadoop-${HADOOP_VERSION}.tar.gz
COPY $HADOOP_FILE /data/rssadmin
RUN tar -zxvf /data/rssadmin/$HADOOP_FILE -C /data/rssadmin
RUN mv /data/rssadmin/hops-${HADOOP_VERSION} /data/rssadmin/hadoop
RUN rm -rf /data/rssadmin/$HADOOP_FILE
COPY hadoopconfig/ /data/rssadmin/hadoop/etc/hadoop

ENV RSS_VERSION ${RSS_VERSION}
Expand Down
25 changes: 17 additions & 8 deletions deploy/kubernetes/docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ function exit_with_usage() {

REGISTRY="docker.io/library"
HADOOP_VERSION=2.8.5
HADOOP_SHORT_VERSION=$(echo $HADOOP_VERSION | awk -F "." '{print $1"."$2}')
AUTHOR=$(whoami)
# If you are based in China, you could pass --apache-mirror <a_mirror_url> when building this.
APACHE_MIRROR="https://dlcdn.apache.org"
Expand Down Expand Up @@ -92,6 +91,8 @@ while (( "$#" )); do
shift
done

HADOOP_SHORT_VERSION=$(echo $HADOOP_VERSION | awk -F "." '{print $1"."$2}')

if [ -z "$BASE_IMAGE" ]; then
echo "start building base image: uniffle-base"
docker build -t "uniffle-base:latest" \
Expand All @@ -101,14 +102,21 @@ else
echo "using base image(${BASE_IMAGE}) to build rss server"
fi

if test -f "/root/.wgetrc"; then
wget https://nexus.hops.works/repository/hopshadoop/hops-$HADOOP_VERSION_EE.tgz
else
wget https://repo.hops.works/master/hops-$HADOOP_VERSION.tgz
fi

HADOOP_FILE=hadoop-${HADOOP_VERSION}.tar.gz
ARCHIVE_HADOOP_URL=https://archive.apache.org/dist/hadoop/core/hadoop-${HADOOP_VERSION}/${HADOOP_FILE}
HADOOP_URL=${APACHE_MIRROR}/hadoop/core/hadoop-${HADOOP_VERSION}/${HADOOP_FILE}
echo "HADOOP_URL is either ${HADOOP_URL} or ${ARCHIVE_HADOOP_URL}"
if [ ! -e "$HADOOP_FILE" ]; \
then wget "${HADOOP_URL}" || wget "$ARCHIVE_HADOOP_URL"; \
else echo "${HADOOP_FILE} has been downloaded"; \
HADOOP_FILE=hops-$HADOOP_VERSION.tgz
if [ ! -e "$HADOOP_FILE" ]; then
if test -f "/root/.wgetrc"; then
wget https://nexus.hops.works/repository/hopshadoop/$HADOOP_FILE
else
wget https://repo.hops.works/master/$HADOOP_FILE
fi
else
echo "${HADOOP_FILE} has been downloaded";
fi

RSS_DIR=../../..
Expand Down Expand Up @@ -137,6 +145,7 @@ docker build --network=host -t "$IMAGE" \
--build-arg GIT_COMMIT="$GIT_COMMIT" \
--build-arg GIT_BRANCH="$GIT_BRANCH" \
--build-arg BASE_IMAGE="$BASE_IMAGE" \
--build-arg HADOOP_FILE="$HADOOP_FILE" \
-f Dockerfile --no-cache .

if [ x"${PUSH_IMAGE}" == x"true" ]; then
Expand Down

0 comments on commit 0675439

Please sign in to comment.