|
|
@@ -0,0 +1,72 @@
|
|
|
+# adapted from https://github.com/docker-library/elasticsearch/blob/master/2.4/Dockerfile
|
|
|
+
|
|
|
+FROM openjdk:8-jre
|
|
|
+
|
|
|
+# grab gosu for easy step-down from root
|
|
|
+ENV GOSU_VERSION 1.10
|
|
|
+RUN set -x \
|
|
|
+ && wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \
|
|
|
+ && wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \
|
|
|
+ && export GNUPGHOME="$(mktemp -d)" \
|
|
|
+ && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
|
|
|
+ && gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \
|
|
|
+ && rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc \
|
|
|
+ && chmod +x /usr/local/bin/gosu \
|
|
|
+ && gosu nobody true
|
|
|
+
|
|
|
+RUN set -ex; \
|
|
|
+# https://artifacts.elastic.co/GPG-KEY-elasticsearch
|
|
|
+ key='46095ACC8548582C1A2699A9D27D666CD88E42B4'; \
|
|
|
+ export GNUPGHOME="$(mktemp -d)"; \
|
|
|
+ gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \
|
|
|
+ gpg --export "$key" > /etc/apt/trusted.gpg.d/elastic.gpg; \
|
|
|
+ rm -rf "$GNUPGHOME"; \
|
|
|
+ apt-key list
|
|
|
+
|
|
|
+# https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-repositories.html
|
|
|
+# https://www.elastic.co/guide/en/elasticsearch/reference/5.0/deb.html
|
|
|
+RUN set -x \
|
|
|
+ && apt-get update && apt-get install -y --no-install-recommends apt-transport-https && rm -rf /var/lib/apt/lists/* \
|
|
|
+ && echo 'deb http://packages.elasticsearch.org/elasticsearch/2.x/debian stable main' > /etc/apt/sources.list.d/elasticsearch.list
|
|
|
+
|
|
|
+ENV ELASTICSEARCH_VERSION 2.4.6
|
|
|
+ENV ELASTICSEARCH_DEB_VERSION 2.4.6
|
|
|
+
|
|
|
+RUN set -x \
|
|
|
+ \
|
|
|
+# don't allow the package to install its sysctl file (causes the install to fail)
|
|
|
+# Failed to write '262144' to '/proc/sys/vm/max_map_count': Read-only file system
|
|
|
+ && dpkg-divert --rename /usr/lib/sysctl.d/elasticsearch.conf \
|
|
|
+ \
|
|
|
+ && apt-get update \
|
|
|
+ && apt-get install -y --no-install-recommends "elasticsearch=$ELASTICSEARCH_DEB_VERSION" \
|
|
|
+ && rm -rf /var/lib/apt/lists/*
|
|
|
+
|
|
|
+ENV PATH /usr/share/elasticsearch/bin:$PATH
|
|
|
+
|
|
|
+WORKDIR /usr/share/elasticsearch
|
|
|
+
|
|
|
+# uid 11002 because 1000 (elasticsearch) conflicts in our infra
|
|
|
+RUN addgroup --gid 11002 elasticsearch-user
|
|
|
+RUN useradd --uid 11002 --gid 11002 --home /usr/share/elasticsearch elasticsearch-user
|
|
|
+
|
|
|
+RUN set -ex \
|
|
|
+ && for path in \
|
|
|
+ ./data \
|
|
|
+ ./logs \
|
|
|
+ ./config \
|
|
|
+ ./config/scripts \
|
|
|
+ ; do \
|
|
|
+ mkdir -p "$path"; \
|
|
|
+ chown -R elasticsearch-user:elasticsearch-user "$path"; \
|
|
|
+ done
|
|
|
+
|
|
|
+RUN yes | bin/plugin install cloud-aws
|
|
|
+
|
|
|
+VOLUME /usr/share/elasticsearch/data
|
|
|
+
|
|
|
+COPY ./docker/elasticsearch/docker-entrypoint.sh /
|
|
|
+
|
|
|
+EXPOSE 9200 9300
|
|
|
+ENTRYPOINT ["/docker-entrypoint.sh"]
|
|
|
+CMD ["elasticsearch"]
|