[es] Upgraded to 2.3.4 and based on alpine

This commit is contained in:
Geoff Bourne 2016-07-09 12:52:02 -05:00
parent ac3cbe75a9
commit 55e38181bd
2 changed files with 28 additions and 17 deletions

View File

@ -1,28 +1,26 @@
FROM java:openjdk-8u72-jdk
FROM java:8u92-jre-alpine
MAINTAINER itzg
ENV ES_VERSION 2.3.2
ENV ES_VERSION=2.3.4
RUN wget -qO /tmp/es.tgz https://download.elasticsearch.org/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/$ES_VERSION/elasticsearch-$ES_VERSION.tar.gz && \
cd /usr/share && \
ADD https://download.elasticsearch.org/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/$ES_VERSION/elasticsearch-$ES_VERSION.tar.gz /tmp/es.tgz
RUN cd /usr/share && \
tar xf /tmp/es.tgz && \
rm /tmp/es.tgz
ENV ES_HOME /usr/share/elasticsearch-$ES_VERSION
RUN useradd -d $ES_HOME -M -r elasticsearch && \
chown -R elasticsearch: $ES_HOME
RUN mkdir /data /conf && touch /data/.CREATED /conf/.CREATED && chown -R elasticsearch: /data /conf
VOLUME ["/data","/conf"]
ADD start /start
WORKDIR $ES_HOME
USER elasticsearch
EXPOSE 9200 9300
ENV OPTS=-Dnetwork.host=_non_loopback_
ENV ES_HOME=/usr/share/elasticsearch-$ES_VERSION \
OPTS=-Dnetwork.host=_non_loopback_ \
DEFAULT_ES_USER=elasticsearch
RUN adduser -S -s /bin/sh $DEFAULT_ES_USER
VOLUME ["/data","/conf"]
WORKDIR $ES_HOME
CMD ["/start"]

View File

@ -16,7 +16,8 @@ OPTS="$OPTS -Des.path.conf=/conf \
-Des.path.data=/data \
-Des.path.logs=/data \
-Des.transport.tcp.port=9300 \
-Des.http.port=9200"
-Des.http.port=9200 \
--path.plugins=/conf/plugins"
if [ -n "$CLUSTER" ]; then
OPTS="$OPTS -Des.cluster.name=$CLUSTER"
@ -51,7 +52,19 @@ if [ -n "$PLUGINS" ]; then
echo "Installing the plugin $p"
$ES_HOME/bin/plugin install $p
done
else
mkdir -p /conf/plugins
fi
mkdir -p /conf/scripts
echo "Starting Elasticsearch with the options $OPTS"
$ES_HOME/bin/elasticsearch $OPTS
CMD="$ES_HOME/bin/elasticsearch $OPTS"
if [ `id -u` = 0 ]; then
echo "Running as non-root..."
chown -R $DEFAULT_ES_USER /data
set -x
su -c "$CMD" - $DEFAULT_ES_USER
else
$CMD
fi