blob: 7e0d7158b3c5e375aad45314b11f7e9abc2fb017 [file] [log] [blame]
su622b87a0a722019-08-20 13:48:58 -04001FROM ubuntu:16.04
sunil unnava97d04ee2018-11-20 15:29:12 -05002
sunil.unnava3426c482019-04-09 01:21:36 -04003ENV ZK_USER=mrzookeeper \
4 ZK_DATA_DIR=/var/lib/zookeeper/data \
sunil unnava61490fb2018-11-21 19:16:02 -05005 ZK_LOG_DIR=/var/log/zookeeper \
su622b87a0a722019-08-20 13:48:58 -04006 JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
7
sunil unnava43d180b2018-11-26 16:35:26 -05008
sunil unnava00cecd82019-01-24 12:38:58 -05009ARG ZK_DIST=zookeeper-3.4.9
sunil unnava61490fb2018-11-21 19:16:02 -050010
sunil unnava5e3d91f2018-11-20 14:43:42 -050011RUN set -x \
su622b87a0a722019-08-20 13:48:58 -040012 && apt-get update \
13 && apt-get install -y openjdk-8-jre-headless wget netcat-openbsd \
14 && apt-get install -y git \
sunil unnavaf084fdf2019-01-24 13:13:10 -050015 && wget -q "http://archive.apache.org/dist/zookeeper/$ZK_DIST/$ZK_DIST.tar.gz" \
16 && wget -q "http://archive.apache.org/dist/zookeeper/$ZK_DIST/$ZK_DIST.tar.gz.asc" \
sunil.unnavaa04ce6f2019-04-15 12:49:19 -040017 && tar -xzf "$ZK_DIST.tar.gz" -C /opt \
sunil unnava43d180b2018-11-26 16:35:26 -050018 && 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 \
su622b87a0a722019-08-20 13:48:58 -040037 && apt-get autoremove -y wget \
sunil unnava61490fb2018-11-21 19:16:02 -050038 && 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.unnavab8bd13e2019-05-02 09:47:39 -040043# Copy APIKeys
44RUN git clone -b master --single-branch http://gerrit.onap.org/r/dmaap/messagerouter/messageservice.git /tmp/zookeeper/gerrit
45
sunil unnava61490fb2018-11-21 19:16:02 -050046# Create a user for the zookeeper process and configure file system ownership
47# for necessary directories and symlink the distribution as a user executable
48RUN set -x \
sunil unnava45f2a0e2018-11-29 17:20:15 -050049 && mkdir -p $ZK_DATA_DIR $ZK_LOG_DIR /usr/share/zookeeper /tmp/zookeeper /usr/etc/ \
sunil unnava61490fb2018-11-21 19:16:02 -050050 && ln -s /opt/zookeeper/conf/ /usr/etc/zookeeper \
51 && ln -s /opt/zookeeper/bin/* /usr/bin \
52 && ln -s /opt/zookeeper/$ZK_DIST.jar /usr/share/zookeeper/ \
sunil unnavae68d4462018-11-21 21:58:13 -050053&& ln -s /opt/zookeeper/lib/* /usr/share/zookeeper
54
sunil unnava4a498292018-11-29 15:23:25 -050055RUN chmod -R 777 /opt/zookeeper/bin
su622b87a0a722019-08-20 13:48:58 -040056ENTRYPOINT /opt/zookeeper/bin/start-zookeeper.sh
sunil unnava4a498292018-11-29 15:23:25 -050057EXPOSE 2181 2888 3888
sunil.unnavac2b85502019-04-08 19:31:14 -040058
su622b87a0a722019-08-20 13:48:58 -040059RUN useradd $ZK_USER \
sunil.unnava3426c482019-04-09 01:21:36 -040060 && [ `id -u $ZK_USER` -eq 1000 ] \
61 && [ `id -g $ZK_USER` -eq 1000 ] \
62 && chown -R $ZK_USER:$ZK_USER /opt/$ZK_DIST/ /opt/zookeeper/ /var/lib/ /var/log/ /tmp/zookeeper/
sunil.unnavac2b85502019-04-08 19:31:14 -040063
sunil.unnava3426c482019-04-09 01:21:36 -040064USER $ZK_USER
su622b87a0a722019-08-20 13:48:58 -040065
66