-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
61 lines (51 loc) · 2.44 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
FROM java:8-jre-alpine
MAINTAINER kost, https://github.com/kost/docker-alpine
# Set environment variables
ENV ES_NAME=elasticsearch \
ELASTICSEARCH_VERSION=2.4.1
ENV ELASTICSEARCH_URL=https://download.elastic.co/$ES_NAME/$ES_NAME/$ES_NAME-$ELASTICSEARCH_VERSION.tar.gz
ENV LOGSTASH_NAME=logstash \
LOGSTASH_VERSION=2.4.0
ENV LOGSTASH_URL https://download.elastic.co/$LOGSTASH_NAME/$LOGSTASH_NAME/$LOGSTASH_NAME-$LOGSTASH_VERSION.tar.gz
ENV KIBANA_VERSION=4.6.1 \
KIBANA_NAME=kibana
ENV KIBANA_PKG=$KIBANA_NAME-$KIBANA_VERSION-linux-x86_64
ENV KIBANA_CONFIG=/opt/$KIBANA_NAME-$KIBANA_VERSION-linux-x86_64/config/kibana.yml
ENV KIBANA_URL=https://download.elastic.co/$KIBANA_NAME/$KIBANA_NAME/$KIBANA_PKG.tar.gz
# Download Elasticsearch
RUN apk add --update openssl nodejs bash \
&& mkdir -p /opt \
&& echo "[i] Building elasticsearch" \
&& echo -O /tmp/$ES_NAME-$ELASTICSEARCH_VERSION.tar.gz $ELASTICSEARCH_URL \
&& wget -O /tmp/$ES_NAME-$ELASTICSEARCH_VERSION.tar.gz $ELASTICSEARCH_URL \
&& tar -xzf /tmp/$ES_NAME-$ELASTICSEARCH_VERSION.tar.gz -C /opt/ \
&& ln -s /opt/$ES_NAME-$ELASTICSEARCH_VERSION /opt/$ES_NAME \
&& adduser -D -S elastic \
&& mkdir -p /var/lib/elasticsearch /opt/$ES_NAME/plugins /opt/$ES_NAME/config/scripts \
&& chown -R elastic /var/lib/elasticsearch /opt/$ES_NAME/plugins /opt/$ES_NAME/config/scripts \
&& echo "[i] Building logstash" \
&& wget -O /tmp/$LOGSTASH_NAME-$LOGSTASH_VERSION.tar.gz $LOGSTASH_URL \
&& tar xzf /tmp/$LOGSTASH_NAME-$LOGSTASH_VERSION.tar.gz -C /opt/ \
&& ln -s /opt/$LOGSTASH_NAME-$LOGSTASH_VERSION /opt/$LOGSTASH_NAME \
&& ln -s /opt/$LOGSTASH_NAME/bin/$LOGSTASH_NAME /usr/local/bin/$LOGSTASH_NAME \
&& mkdir /etc/$LOGSTASH_NAME \
&& echo "[i] Building kibana" \
&& wget -O /tmp/$KIBANA_PKG.tar.gz $KIBANA_URL \
&& tar -xzf /tmp/$KIBANA_PKG.tar.gz -C /opt/ \
&& ln -s /opt/$KIBANA_PKG /opt/$KIBANA_NAME \
&& rm -rf /opt/$KIBANA_PKG/node/ \
&& mkdir -p /opt/$KIBANA_PKG/node/bin/ \
&& ln -s $(which node) /opt/$KIBANA_NAME/node/bin/node \
&& echo "[i] Finishing" \
&& rm -rf /tmp/*.tar.gz /var/cache/apk/* \
&& echo "[i] Done"
# Add files
COPY config/elasticsearch.yml /opt/elasticsearch/config/elasticsearch.yml
ADD config/logstash.json /etc/$LOGSTASH_NAME/$LOGSTASH_NAME.json
ADD scripts /scripts
# Specify Volume
VOLUME ["/var/lib/elasticsearch"]
# Exposes
EXPOSE 9200 9300 5601 514 514/udp 8080
# CMD
ENTRYPOINT ["/scripts/run.sh"]