blob: 905b27d0c5b06ae1a6f411e45cb117c65aa40c40 [file] [log] [blame]
sunil unnava5e3d91f2018-11-20 14:43:42 -05001FROM ubuntu:16.04
2ENV ZK_USER=zookeeper \
3ZK_DATA_DIR=/var/lib/zookeeper/data \
4ZK_DATA_LOG_DIR=/var/lib/zookeeper/log \
5ZK_LOG_DIR=/var/log/zookeeper \
6JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
7
8ARG GPG_KEY=C823E3E5B12AF29C67F81976F5CECB3CB5E9BD2D
9ARG ZK_DIST=zookeeper-3.4.10
10RUN set -x \
11 && apt-get update \
12 && apt-get install -y openjdk-8-jre-headless wget netcat-openbsd \
13 && wget -q "http://www.apache.org/dist/zookeeper/$ZK_DIST/$ZK_DIST.tar.gz" \
14 && wget -q "http://www.apache.org/dist/zookeeper/$ZK_DIST/$ZK_DIST.tar.gz.asc" \
15 && export GNUPGHOME="$(mktemp -d)" \
16 && gpg --keyserver ha.pool.sks-keyservers.net --recv-key "$GPG_KEY" \
17 && gpg --batch --verify "$ZK_DIST.tar.gz.asc" "$ZK_DIST.tar.gz" \
18 && tar -xzf "$ZK_DIST.tar.gz" -C /opt \
19 && rm -r "$GNUPGHOME" "$ZK_DIST.tar.gz" "$ZK_DIST.tar.gz.asc" \
20 && ln -s /opt/$ZK_DIST /opt/zookeeper \
21 && rm -rf /opt/zookeeper/CHANGES.txt \
22 /opt/zookeeper/README.txt \
23 /opt/zookeeper/NOTICE.txt \
24 /opt/zookeeper/CHANGES.txt \
25 /opt/zookeeper/README_packaging.txt \
26 /opt/zookeeper/build.xml \
27 /opt/zookeeper/config \
28 /opt/zookeeper/contrib \
29 /opt/zookeeper/dist-maven \
30 /opt/zookeeper/docs \
31 /opt/zookeeper/ivy.xml \
32 /opt/zookeeper/ivysettings.xml \
33 /opt/zookeeper/recipes \
34 /opt/zookeeper/src \
35 /opt/zookeeper/$ZK_DIST.jar.asc \
36 /opt/zookeeper/$ZK_DIST.jar.md5 \
37 /opt/zookeeper/$ZK_DIST.jar.sha1 \
38 && apt-get autoremove -y wget \
39 && rm -rf /var/lib/apt/lists/*
40
41#Copy configuration generator script to bin
42COPY scripts /opt/zookeeper/bin/
43
44# Create a user for the zookeeper process and configure file system ownership
45# for nessecary directories and symlink the distribution as a user executable
46RUN set -x \
47 && useradd $ZK_USER \
48 && [ `id -u $ZK_USER` -eq 1000 ] \
49 && [ `id -g $ZK_USER` -eq 1000 ] \
50 && mkdir -p $ZK_DATA_DIR $ZK_DATA_LOG_DIR $ZK_LOG_DIR /usr/share/zookeeper /tmp/zookeeper /usr/etc/ \
51 && chown -R "$ZK_USER:$ZK_USER" /opt/$ZK_DIST $ZK_DATA_DIR $ZK_LOG_DIR $ZK_DATA_LOG_DIR /tmp/zookeeper \
52 && ln -s /opt/zookeeper/conf/ /usr/etc/zookeeper \
53 && ln -s /opt/zookeeper/bin/* /usr/bin \
54 && ln -s /opt/zookeeper/$ZK_DIST.jar /usr/share/zookeeper/ \
55 && ln -s /opt/zookeeper/lib/* /usr/share/zookeeper