blob: 37bc513db8a1c771cbfe3a85508227f2c8f368c1 [file] [log] [blame]
sunil unnava97d04ee2018-11-20 15:29:12 -05001FROM ubuntu:16.04
2
sunil unnavae68d4462018-11-21 21:58:13 -05003ENV ZK_USER=root \
sunil unnava61490fb2018-11-21 19:16:02 -05004 ZK_DATA_DIR=/var/lib/zookeeper/data \
5 ZK_DATA_LOG_DIR=/var/lib/zookeeper/log \
6 ZK_LOG_DIR=/var/log/zookeeper \
7 JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
sunil unnava5e3d91f2018-11-20 14:43:42 -05008
sunil unnava43d180b2018-11-26 16:35:26 -05009
sunil unnava5e3d91f2018-11-20 14:43:42 -050010ARG ZK_DIST=zookeeper-3.4.10
sunil unnava61490fb2018-11-21 19:16:02 -050011
sunil unnava5e3d91f2018-11-20 14:43:42 -050012RUN set -x \
13 && apt-get update \
14 && apt-get install -y openjdk-8-jre-headless wget netcat-openbsd \
sunil unnava97d04ee2018-11-20 15:29:12 -050015 && wget -q "http://www.apache.org/dist/zookeeper/$ZK_DIST/$ZK_DIST.tar.gz" \
sunil unnava5e3d91f2018-11-20 14:43:42 -050016 && wget -q "http://www.apache.org/dist/zookeeper/$ZK_DIST/$ZK_DIST.tar.gz.asc" \
sunil unnava43d180b2018-11-26 16:35:26 -050017 && tar -xzf "$ZK_DIST.tar.gz" -C /opt \
18 && rm -r "$ZK_DIST.tar.gz" "$ZK_DIST.tar.gz.asc" \
sunil unnava5e3d91f2018-11-20 14:43:42 -050019 && ln -s /opt/$ZK_DIST /opt/zookeeper \
20 && rm -rf /opt/zookeeper/CHANGES.txt \
21 /opt/zookeeper/README.txt \
22 /opt/zookeeper/NOTICE.txt \
23 /opt/zookeeper/CHANGES.txt \
24 /opt/zookeeper/README_packaging.txt \
25 /opt/zookeeper/build.xml \
26 /opt/zookeeper/config \
27 /opt/zookeeper/contrib \
28 /opt/zookeeper/dist-maven \
29 /opt/zookeeper/docs \
30 /opt/zookeeper/ivy.xml \
31 /opt/zookeeper/ivysettings.xml \
32 /opt/zookeeper/recipes \
33 /opt/zookeeper/src \
34 /opt/zookeeper/$ZK_DIST.jar.asc \
35 /opt/zookeeper/$ZK_DIST.jar.md5 \
36 /opt/zookeeper/$ZK_DIST.jar.sha1 \
sunil unnava61490fb2018-11-21 19:16:02 -050037 && apt-get autoremove -y wget \
38 && rm -rf /var/lib/apt/lists/*
sunil unnava97d04ee2018-11-20 15:29:12 -050039
sunil unnava61490fb2018-11-21 19:16:02 -050040# Copy configuration generator script to bin
sunil unnava1fd255a2018-11-21 19:40:03 -050041COPY scripts /opt/zookeeper/bin/
sunil unnava94d27692018-11-26 09:37:28 -050042
sunil unnava61490fb2018-11-21 19:16:02 -050043# Create a user for the zookeeper process and configure file system ownership
44# for necessary directories and symlink the distribution as a user executable
45RUN set -x \
sunil unnava61490fb2018-11-21 19:16:02 -050046 && mkdir -p $ZK_DATA_DIR $ZK_DATA_LOG_DIR $ZK_LOG_DIR /usr/share/zookeeper /tmp/zookeeper /usr/etc/ \
47 && chown -R "$ZK_USER:$ZK_USER" /opt/$ZK_DIST $ZK_DATA_DIR $ZK_LOG_DIR $ZK_DATA_LOG_DIR /tmp/zookeeper \
48 && ln -s /opt/zookeeper/conf/ /usr/etc/zookeeper \
49 && ln -s /opt/zookeeper/bin/* /usr/bin \
50 && ln -s /opt/zookeeper/$ZK_DIST.jar /usr/share/zookeeper/ \
sunil unnavae68d4462018-11-21 21:58:13 -050051&& ln -s /opt/zookeeper/lib/* /usr/share/zookeeper
52
sunil unnava4a498292018-11-29 15:23:25 -050053RUN chmod -R 777 /opt/zookeeper/bin
54ENTRYPOINT /opt/zookeeper/bin/start-zookeeper.sh
55EXPOSE 2181 2888 3888