diff --git a/.travis.yml b/.travis.yml index 1dd332f..e36be90 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,7 @@ language: bash services: docker env: + - VERSION=5.0 - VERSION=2.3 - VERSION=2.2 - VERSION=2.1 diff --git a/5.0/Dockerfile b/5.0/Dockerfile new file mode 100644 index 0000000..d32b118 --- /dev/null +++ b/5.0/Dockerfile @@ -0,0 +1,53 @@ +FROM java:8-jre + +# grab gosu for easy step-down from root +ENV GOSU_VERSION 1.7 +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 -r "$GNUPGHOME" /usr/local/bin/gosu.asc \ + && chmod +x /usr/local/bin/gosu \ + && gosu nobody true + +# https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-repositories.html +# https://packages.elasticsearch.org/GPG-KEY-elasticsearch +RUN apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys 46095ACC8548582C1A2699A9D27D666CD88E42B4 + +ENV ELASTICSEARCH_MAJOR 5.0 +ENV ELASTICSEARCH_VERSION 5.0.0~alpha1 +ENV ELASTICSEARCH_REPO_BASE http://packages.elasticsearch.org/elasticsearch/5.x/debian + +RUN echo "deb $ELASTICSEARCH_REPO_BASE stable main" > /etc/apt/sources.list.d/elasticsearch.list + +RUN set -x \ + && apt-get update \ + && apt-get install -y --no-install-recommends elasticsearch=$ELASTICSEARCH_VERSION \ + && rm -rf /var/lib/apt/lists/* + +ENV PATH /usr/share/elasticsearch/bin:$PATH + +WORKDIR /usr/share/elasticsearch + +RUN set -ex \ + && for path in \ + ./data \ + ./logs \ + ./config \ + ./config/scripts \ + ; do \ + mkdir -p "$path"; \ + chown -R elasticsearch:elasticsearch "$path"; \ + done + +COPY config ./config + +VOLUME /usr/share/elasticsearch/data + +COPY docker-entrypoint.sh / + +EXPOSE 9200 9300 +ENTRYPOINT ["/docker-entrypoint.sh"] +CMD ["elasticsearch"] diff --git a/5.0/config/elasticsearch.yml b/5.0/config/elasticsearch.yml new file mode 100644 index 0000000..5108c77 --- /dev/null +++ b/5.0/config/elasticsearch.yml @@ -0,0 +1 @@ +network.host: 0.0.0.0 diff --git a/5.0/config/logging.yml b/5.0/config/logging.yml new file mode 100644 index 0000000..c2681ac --- /dev/null +++ b/5.0/config/logging.yml @@ -0,0 +1,15 @@ +# you can override this using by setting a system property, for example -Des.logger.level=DEBUG +es.logger.level: INFO +rootLogger: ${es.logger.level}, console +logger: + # log action execution errors for easier debugging + action: DEBUG + # reduce the logging for aws, too much is logged under the default INFO + com.amazonaws: WARN + +appender: + console: + type: console + layout: + type: consolePattern + conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n" diff --git a/5.0/docker-entrypoint.sh b/5.0/docker-entrypoint.sh new file mode 100755 index 0000000..09dd9fc --- /dev/null +++ b/5.0/docker-entrypoint.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +set -e + +# Add elasticsearch as command if needed +if [ "${1:0:1}" = '-' ]; then + set -- elasticsearch "$@" +fi + +# Drop root privileges if we are running elasticsearch +# allow the container to be started with `--user` +if [ "$1" = 'elasticsearch' -a "$(id -u)" = '0' ]; then + # Change the ownership of /usr/share/elasticsearch/data to elasticsearch + chown -R elasticsearch:elasticsearch /usr/share/elasticsearch/data + + set -- gosu elasticsearch "$@" + #exec gosu elasticsearch "$BASH_SOURCE" "$@" +fi + +# As argument is not related to elasticsearch, +# then assume that user wants to run his own process, +# for example a `bash` shell to explore this image +exec "$@"