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

OpenJDK-8 Alpine image #22

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# HBase in Docker
#
# Version 0.3
# Version 0.4

# http://docs.docker.io/en/latest/use/builder/

FROM ubuntu:xenial
FROM openjdk:8-jre-alpine
MAINTAINER Dave Beckett <dave@dajobe.org>

COPY *.sh /build/

ENV HBASE_VERSION 1.2.4
ENV HBASE_VERSION 1.2.6

RUN /build/prepare-hbase.sh && \
cd /opt/hbase && /build/build-hbase.sh \
Expand Down
9 changes: 1 addition & 8 deletions cleanup-hbase.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,8 @@

. /build/config-hbase.sh

AUTO_ADDED_PACKAGES=`apt-mark showauto`
apk del $HBASE_BUILD_PACKAGES

apt-get remove --purge -y $HBASE_BUILD_PACKAGES $AUTO_ADDED_PACKAGES

# Install the run-time dependencies
apt-get install $minimal_apt_get_args $HBASE_RUN_PACKAGES

# . /build/cleanup.sh
rm -rf /tmp/* /var/tmp/*

apt-get clean
rm -rf /var/lib/apt/lists/*
20 changes: 15 additions & 5 deletions config-hbase.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,33 @@

# . /build/config.sh

function get_closest_site() {

DISPATCHER_SITE="http://www.apache.org/dyn/closer.cgi/hbase/"

echo $(curl -s $DISPATCHER_SITE | grep strong | head -n 1 | sed 's|.*href="\(.\+\?\)".*|\1|')

}


# This is the definitive site and incredibly slow
HBASE_DIST="http://archive.apache.org/dist/hbase"
HBASE_ORIG_DIST="http://archive.apache.org/dist/hbase"
HBASE_DIST=$HBASE_ORIG_DIST
# This is a mirror site and faster but every new release breaks all
# existing links.
# HBASE_DIST="https://www-us.apache.org/dist/hbase"
# Uncomment this line to download from the closest site:
#export USE_DISPATCHER=1

# Prevent initramfs updates from trying to run grub and lilo.
export INITRD=no
export DEBIAN_FRONTEND=noninteractive
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64

minimal_apt_get_args='-y --no-install-recommends'
export JAVA_HOME=/usr/lib/jvm/default-jvm


## Build time dependencies ##

HBASE_BUILD_PACKAGES="curl"
HBASE_BUILD_PACKAGES="curl gnupg"

# Core list from docs
#HBASE_BUILD_PACKAGES="$HBASE_BUILD_PACKAGES "
Expand Down
28 changes: 23 additions & 5 deletions prepare-hbase.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
#!/bin/sh -x
#!/bin/sh -xe

. /build/config-hbase.sh

apt-get update -y

apt-get install $minimal_apt_get_args $HBASE_BUILD_PACKAGES
apk update
apk add bash $HBASE_BUILD_PACKAGES

mkdir -p /opt
cd /opt

curl -SL $HBASE_DIST/$HBASE_VERSION/hbase-$HBASE_VERSION-bin.tar.gz | tar -x -z && mv hbase-${HBASE_VERSION} hbase
if [ -n $USE_DISPATCHER ]
then
HBASE_DIST=$(get_closest_site)
fi

# download package
curl -SLO $HBASE_DIST/$HBASE_VERSION/hbase-$HBASE_VERSION-bin.tar.gz
# download PGP keys
curl -SLO $HBASE_ORIG_DIST/KEYS
# download checksum
curl -SL $HBASE_ORIG_DIST/$HBASE_VERSION/hbase-$HBASE_VERSION-bin.tar.gz.asc -o download.asc

# validate the version
gpg --import KEYS
gpg --verify download.asc hbase-$HBASE_VERSION-bin.tar.gz

# finally unpack and cleanup
tar xzf hbase-$HBASE_VERSION-bin.tar.gz && mv hbase-${HBASE_VERSION} hbase
rm -f hbase-$HBASE_VERSION-bin.tar.gz KEYS download.asc
5 changes: 4 additions & 1 deletion replace-hostname
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@ declare -a files=(
'/opt/hbase/conf/zoo.cfg'
)

# enable custom replacement (e.g. service name on k8s)
REPLACEMENT=${HBASE_SERVICE_NAME:-$HOSTNAME}

for file in "${files[@]}"; do
if [ -f "${file}.bak" ]; then
cp "${file}.bak" "${file}"
else
cp "${file}" "${file}.bak"
fi

sed -i "s/hbase-docker/${HOSTNAME}/g" "${file}"
sed -i "s/hbase-docker/${REPLACEMENT}/g" "${file}"
done