su622b | 87a0a72 | 2019-08-20 13:48:58 -0400 | [diff] [blame^] | 1 | FROM ubuntu:16.04 |
sunil unnava | 97d04ee | 2018-11-20 15:29:12 -0500 | [diff] [blame] | 2 | |
sunil.unnava | 3426c48 | 2019-04-09 01:21:36 -0400 | [diff] [blame] | 3 | ENV ZK_USER=mrzookeeper \ |
| 4 | ZK_DATA_DIR=/var/lib/zookeeper/data \ |
sunil unnava | 61490fb | 2018-11-21 19:16:02 -0500 | [diff] [blame] | 5 | ZK_LOG_DIR=/var/log/zookeeper \ |
su622b | 87a0a72 | 2019-08-20 13:48:58 -0400 | [diff] [blame^] | 6 | JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 |
| 7 | |
sunil unnava | 43d180b | 2018-11-26 16:35:26 -0500 | [diff] [blame] | 8 | |
sunil unnava | 00cecd8 | 2019-01-24 12:38:58 -0500 | [diff] [blame] | 9 | ARG ZK_DIST=zookeeper-3.4.9 |
sunil unnava | 61490fb | 2018-11-21 19:16:02 -0500 | [diff] [blame] | 10 | |
sunil unnava | 5e3d91f | 2018-11-20 14:43:42 -0500 | [diff] [blame] | 11 | RUN set -x \ |
su622b | 87a0a72 | 2019-08-20 13:48:58 -0400 | [diff] [blame^] | 12 | && apt-get update \ |
| 13 | && apt-get install -y openjdk-8-jre-headless wget netcat-openbsd \ |
| 14 | && apt-get install -y git \ |
sunil unnava | f084fdf | 2019-01-24 13:13:10 -0500 | [diff] [blame] | 15 | && 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.unnava | a04ce6f | 2019-04-15 12:49:19 -0400 | [diff] [blame] | 17 | && tar -xzf "$ZK_DIST.tar.gz" -C /opt \ |
sunil unnava | 43d180b | 2018-11-26 16:35:26 -0500 | [diff] [blame] | 18 | && rm -r "$ZK_DIST.tar.gz" "$ZK_DIST.tar.gz.asc" \ |
sunil unnava | 5e3d91f | 2018-11-20 14:43:42 -0500 | [diff] [blame] | 19 | && 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 \ |
su622b | 87a0a72 | 2019-08-20 13:48:58 -0400 | [diff] [blame^] | 37 | && apt-get autoremove -y wget \ |
sunil unnava | 61490fb | 2018-11-21 19:16:02 -0500 | [diff] [blame] | 38 | && rm -rf /var/lib/apt/lists/* |
sunil unnava | 97d04ee | 2018-11-20 15:29:12 -0500 | [diff] [blame] | 39 | |
sunil unnava | 61490fb | 2018-11-21 19:16:02 -0500 | [diff] [blame] | 40 | # Copy configuration generator script to bin |
sunil unnava | 1fd255a | 2018-11-21 19:40:03 -0500 | [diff] [blame] | 41 | COPY scripts /opt/zookeeper/bin/ |
sunil unnava | 94d2769 | 2018-11-26 09:37:28 -0500 | [diff] [blame] | 42 | |
sunil.unnava | b8bd13e | 2019-05-02 09:47:39 -0400 | [diff] [blame] | 43 | # Copy APIKeys |
| 44 | RUN git clone -b master --single-branch http://gerrit.onap.org/r/dmaap/messagerouter/messageservice.git /tmp/zookeeper/gerrit |
| 45 | |
sunil unnava | 61490fb | 2018-11-21 19:16:02 -0500 | [diff] [blame] | 46 | # Create a user for the zookeeper process and configure file system ownership |
| 47 | # for necessary directories and symlink the distribution as a user executable |
| 48 | RUN set -x \ |
sunil unnava | 45f2a0e | 2018-11-29 17:20:15 -0500 | [diff] [blame] | 49 | && mkdir -p $ZK_DATA_DIR $ZK_LOG_DIR /usr/share/zookeeper /tmp/zookeeper /usr/etc/ \ |
sunil unnava | 61490fb | 2018-11-21 19:16:02 -0500 | [diff] [blame] | 50 | && 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 unnava | e68d446 | 2018-11-21 21:58:13 -0500 | [diff] [blame] | 53 | && ln -s /opt/zookeeper/lib/* /usr/share/zookeeper |
| 54 | |
sunil unnava | 4a49829 | 2018-11-29 15:23:25 -0500 | [diff] [blame] | 55 | RUN chmod -R 777 /opt/zookeeper/bin |
su622b | 87a0a72 | 2019-08-20 13:48:58 -0400 | [diff] [blame^] | 56 | ENTRYPOINT /opt/zookeeper/bin/start-zookeeper.sh |
sunil unnava | 4a49829 | 2018-11-29 15:23:25 -0500 | [diff] [blame] | 57 | EXPOSE 2181 2888 3888 |
sunil.unnava | c2b8550 | 2019-04-08 19:31:14 -0400 | [diff] [blame] | 58 | |
su622b | 87a0a72 | 2019-08-20 13:48:58 -0400 | [diff] [blame^] | 59 | RUN useradd $ZK_USER \ |
sunil.unnava | 3426c48 | 2019-04-09 01:21:36 -0400 | [diff] [blame] | 60 | && [ `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.unnava | c2b8550 | 2019-04-08 19:31:14 -0400 | [diff] [blame] | 63 | |
sunil.unnava | 3426c48 | 2019-04-09 01:21:36 -0400 | [diff] [blame] | 64 | USER $ZK_USER |
su622b | 87a0a72 | 2019-08-20 13:48:58 -0400 | [diff] [blame^] | 65 | |
| 66 | |