forked from HariSekhon/Dockerfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
96 lines (83 loc) · 4.02 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#
# Author: Hari Sekhon
# Date: 2016-04-24 21:18:57 +0100 (Sun, 24 Apr 2016)
#
# vim:ts=4:sts=4:sw=4:et
#
# https://github.com/harisekhon/Dockerfiles
#
# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback
#
# https://www.linkedin.com/in/harisekhon
#
FROM harisekhon/alpine-java:jre8
MAINTAINER Hari Sekhon (https://www.linkedin.com/in/harisekhon)
ARG HBASE_VERSION=2.1.3
ENV PATH $PATH:/hbase/bin
ENV JAVA_HOME=/usr
LABEL Description="HBase" \
"HBase Version"="$HBASE_VERSION"
WORKDIR /
# bash - needed for entrypoint.sh
RUN apk add --no-cache bash
# hadolint ignore=SC2039
RUN set -eux && \
apk add --no-cache wget tar && \
# older versions have to use apache archive
# HBase 0.90, 0.92, 0.94
if [ "${HBASE_VERSION:0:4}" = "0.90" ] || \
[ "${HBASE_VERSION:0:4}" = "0.92" ] || \
[ "${HBASE_VERSION:0:4}" = "0.94" ]; then \
url="http://www.apache.org/dyn/closer.lua?filename=hbase/hbase-$HBASE_VERSION/hbase-$HBASE_VERSION.tar.gz&action=download"; \
url_archive="http://archive.apache.org/dist/hbase/hbase-$HBASE_VERSION/hbase-$HBASE_VERSION.tar.gz"; \
# HBase 0.95 / 0.96
elif [ "${HBASE_VERSION:0:4}" = "0.95" ] || \
[ "${HBASE_VERSION:0:4}" = "0.96" ]; then \
url="https://archive.apache.org/dist/hbase/hbase-$HBASE_VERSION/hbase-$HBASE_VERSION-hadoop2-bin.tar.gz"; \
url_archive="http://archive.apache.org/dist/hbase/hbase-$HBASE_VERSION/hbase-$HBASE_VERSION-hadoop2-bin.tar.gz"; \
# HBase 0.98
elif [ "${HBASE_VERSION:0:4}" = "0.98" ]; then \
url="http://www.apache.org/dyn/closer.lua?filename=hbase/$HBASE_VERSION/hbase-$HBASE_VERSION-hadoop2-bin.tar.gz&action=download"; \
url_archive="http://archive.apache.org/dist/hbase/$HBASE_VERSION/hbase-$HBASE_VERSION-hadoop2-bin.tar.gz"; \
# HBase 0.99 / 1.0
elif [ "${HBASE_VERSION:0:4}" = "0.99" ] || \
[ "${HBASE_VERSION:0:3}" = "1.0" ]; then \
url="http://www.apache.org/dyn/closer.lua?filename=hbase/hbase-$HBASE_VERSION/hbase-$HBASE_VERSION-bin.tar.gz&action=download"; \
url_archive="http://archive.apache.org/dist/hbase/hbase-$HBASE_VERSION/hbase-$HBASE_VERSION-bin.tar.gz"; \
# HBase 1.1+
else \
url="http://www.apache.org/dyn/closer.lua?filename=hbase/$HBASE_VERSION/hbase-$HBASE_VERSION-bin.tar.gz&action=download"; \
url_archive="http://archive.apache.org/dist/hbase/$HBASE_VERSION/hbase-$HBASE_VERSION-bin.tar.gz"; \
fi && \
# --max-redirect - some apache mirrors redirect a couple times and give you the latest version instead
# but this breaks stuff later because the link will not point to the right dir
# (and is also the wrong version for the tag)
wget -t 10 --max-redirect 1 --retry-connrefused -O "hbase-$HBASE_VERSION-bin.tar.gz" "$url" || \
wget -t 10 --max-redirect 1 --retry-connrefused -O "hbase-$HBASE_VERSION-bin.tar.gz" "$url_archive" && \
mkdir "hbase-$HBASE_VERSION" && \
tar zxf "hbase-$HBASE_VERSION-bin.tar.gz" -C "hbase-$HBASE_VERSION" --strip 1 && \
test -d "hbase-$HBASE_VERSION" && \
ln -sv "hbase-$HBASE_VERSION" hbase && \
rm -fv "hbase-$HBASE_VERSION-bin.tar.gz" && \
rm -rf hbase/docs hbase/src && \
mkdir /hbase-data && \
apk del tar wget
# Needed for HBase 2.0+ hbase-shell
# asciidoctor solves 'NotImplementedError: fstat unimplemented unsupported or native support failed to load'
RUN bash -c ' \
set -euxo pipefail && \
echo "http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories && \
apk add --no-cache jruby jruby-irb asciidoctor && \
echo exit | hbase shell \
# jruby-maven jruby-minitest jruby-rdoc jruby-rake jruby-testunit && \
'
VOLUME /hbase-data
COPY entrypoint.sh /
COPY conf/hbase-site.xml /hbase/conf/
COPY profile.d/java.sh /etc/profile.d/
# Stargate 8080 / 8085
# Thrift 9090 / 9095
# HMaster 16000 / 16010
# RS 16201 / 16301
EXPOSE 2181 8080 8085 9090 9095 16000 16010 16030 16201 16301
ENTRYPOINT ["/entrypoint.sh"]